You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Saman Rasheed <sa...@hotmail.com> on 2017/04/25 10:46:34 UTC
termfreq usage/syntax
hi Solr team, i'm starting to have fun with solr, and i'm in a big project that requires me to index some books and then do certain term lookups on them.
I'm using windows 10 and i've successfully managed to index a book containing more than 118,000 words! which is normal i guess.
in the solr admin UI, if i, for example do a look up on a term let's say 'house', i type in 'fl' field the following:
termfreq(content,house)
and i get the following response:
{ "responseHeader":{ "status":0, "QTime":166, "params":{ "q":"*:*", "indent":"on", "fl":"termfreq(content,house)", "wt":"json", "_":"1493115416033"}}, "response":{"numFound":1,"start":0,"docs":[ { "termfreq(content,house)":200}] }
and this is what i expect, however i havent been successful in doing an approximate searchon the word 'house' i.e when 'house' is part or in the middle of word! e.g. 'rehousing' or 'housing'.
what i'm looking for is syntax similair to: 'termfreq(content,*house*)'
which doesnt work.
i've had a look at the online wiki reference on the section below:
termfreq
Returns the number of times the term appears in the field for that document.
termfreq(text,'memory')
from: https://cwiki.apache.org/confluence/display/solr/Function+Queries
and i've substituted the words 'text' and 'memory' with the ones in my example above, still no luck on approximate searches.
not sure what i'm doing wrong here, can you please help.
regards,
Sam.
Re: termfreq usage/syntax
Posted by Shawn Heisey <ap...@elyograg.org>.
On 4/25/2017 4:46 AM, Saman Rasheed wrote:
> what i'm looking for is syntax similair to: 'termfreq(content,*house*)'
> which doesnt work.
I doubt this function knows how to deal with wildcards. It sounds like
it can only do exact terms.
One option you have is to use the /terms handler with the terms.regex
parameter to get a list all terms that match the regex with their
counts, and add up the numbers on the client side.
Here's some documentation on the Terms Component and the /terms handler
that uses it:
https://cwiki.apache.org/confluence/display/solr/The+Terms+Component
Thanks,
Shawn