Reputation: 31
Good! I need to get the number of occurrences of a search term for each document stored in Solr (I have indexed "PDF" documents).
That is, if you have the following information:
So, if I search for "house", I need to obtain that for document A it appears 3 times, for B 4 times and for C 1 time. And in total 8 times (3 + 4 + 1). How can I do this in a query from HTTP, that is "'http: // localhost: 8983 / solr / ......."?
Thank you very much, Regards.
Upvotes: 3
Views: 1051
Reputation: 9789
I am assuming you indexed the whole document into one field (e.g. text). In which case, you can use a Function Query termfreq to return number of times your term shows up in that field.
There are several ways to use a function query, including using it as a pseudo-field by just putting it in the fl field list:
http://localhost:8983/solr/corename/select?fl=*,termfreq(text,"house")&q=house
Upvotes: 2