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 Rahul Warawdekar <ra...@gmail.com> on 2011/02/09 17:55:54 UTC
Query regarding search term count in Solr
Hi All,
This is Rahul and am using Solr for one of my upcoming projects.
I had a query regarding search term count using Solr.
We have a requirement in one of our search based projects to search the
results based on search term counts per document.
For eg,
if a user searches for something like "solr[4:9]", this query should return
only documents in which solr appears between 4 and 9 times (inclusively).
if a user searches for something like "solr lucene[4:9]", this query should
return only documents in which the phrase "solr lucene" appears between 4
and 9 times (inclusively).
Is there any way from Solr to return results based on the search term and
phrase counts ?
If not, can it be customized by extending existing Solr/Lucene libraries ?
--
Thanks and Regards
Rahul A. Warawdekar
Re: Query regarding search term count in Solr
Posted by Erick Erickson <er...@gmail.com>.
I suspect it's worthwhile to back up and ask whether this is a reasonable
requirement. What is the use-case? Because unless the input is very
uniform, I wouldn't be surprised if this will produce poor results. For
instance,
if "solr" appears once in a field 5 words long and 5 times in another
document
where the same field is 1,000,000 words long, which is preferable?
This requirement can make sense if the fields being searched are uniform
in length, but even then I'm not sure it would be good for the user....
That said, you know your problem domain best but before going through the
effort of making this all work I'd step back and ask this question.
There is no way that I know of of doing this out of the box with Solr. I can
imagine you could set up a custom scorer that accessed the underlying
TermDocs (see TermDocs in the Lucene API), but you'd also have to provide
your own query parser...
I'll reiterate, though, that it might be best to see if there are already
ways in Solr to get "close enough" behavior to satisfy the underlying
requirement rather than go down this route.
Best
Erick
On Wed, Feb 9, 2011 at 11:55 AM, Rahul Warawdekar <
rahul.warawdekar@gmail.com> wrote:
> Hi All,
>
> This is Rahul and am using Solr for one of my upcoming projects.
> I had a query regarding search term count using Solr.
> We have a requirement in one of our search based projects to search the
> results based on search term counts per document.
>
> For eg,
> if a user searches for something like "solr[4:9]", this query should return
> only documents in which solr appears between 4 and 9 times (inclusively).
> if a user searches for something like "solr lucene[4:9]", this query
> should
> return only documents in which the phrase "solr lucene" appears between 4
> and 9 times (inclusively).
>
> Is there any way from Solr to return results based on the search term and
> phrase counts ?
> If not, can it be customized by extending existing Solr/Lucene libraries ?
>
>
> --
> Thanks and Regards
> Rahul A. Warawdekar
>