1

I'm using HBase 0.90 for data storing and Solr 3.6 to query on my DB. Is there any query that returns how many times a pattern matches in my DB?

I can get the result that I want using this shell command

curl "<ToSolrRequest>" | egrep -o '<MatchingPattern>' | sort | uniq -c

I want to obtain the same result using a query of Solr/Lucene. How can i do it?

Mysterion
  • 9,050
  • 3
  • 30
  • 52
  • could you share your solr schema? without this information it will be tough to create proper query – Mysterion Dec 10 '17 at 11:27
  • https://github.com/Lorenzo-Epifani/SolrSchema/commit/9874345224653e36ff5f8c4c68083f2e546d7c62 – Lorenzo Epifani Dec 10 '17 at 12:26
  • great, and which field do you want to test for matching pattern? – Mysterion Dec 10 '17 at 13:43
  • I'd like to test the content field. – Lorenzo Epifani Dec 10 '17 at 15:08
  • You'll need to upgrade to at least Solr 4.0, which [introduces regex support in its query syntax](https://stackoverflow.com/questions/9332343/what-regular-expression-features-are-supported-by-solr-edismax). – MatsLindh Dec 10 '17 at 19:59
  • Ok, i've upgraded to solr 4.8.1 and modified properly the config XML files, everything seems ok. How can I write that query? – Lorenzo Epifani Dec 10 '17 at 21:51
  • No idea why you wouldn't go directly to 4.10.x if you're staying within 4.x, but you can query using `field:/pattern/` and then look at the total number of hits returned in the response. You can also use faceting to get the number of unique values. – MatsLindh Dec 11 '17 at 10:42

0 Answers0