On 24-7-2013 21:58 Sriram Sankar wrote:
> On Wed, Jul 24, 2013 at 10:24 AM, Jack Krupansky <jack@basetechnology.com>wrote:
>> Scoring has been a major focus of Lucene. Non-scored filters are also
>> available, but the query parsers are focused (exclusively) on scored-search.
>>
>
> When you say "filter" do you mean a step performed after retrieval? Or is
> it yet another retrieval operation?
He is really referring to the Filters available as an addition to
retrieval. The ones you supply with the search-method:
http://lucene.apache.org/core/4_4_0/core/org/apache/lucene/search/IndexSearcher.html#search%28org.apache.lucene.search.Query,%20org.apache.lucene.search.Filter,%20int%29
Unfortunately the documentation of Lucene is a bit fragmented, but
basically they limit the scope of your search domain (i.e. reduce the
available set of documents) during the processing of a query. So it
basically becomes (query) AND (filters).
There are several useful implementations available for the filters. But
in your case you can just create a single TermsFilter (its in the
queries module/package) which is simply a OR-list like the one in your
example (similar to a basic IN in sql):
http://lucene.apache.org/core/4_4_0/queries/org/apache/lucene/queries/TermsFilter.html
So searching would become:
- Create a Query with only your termA
- Create a TermsFilter with all your termB's
- execute your preferred search-method with both the query and the filter
If you where interested in the scores of each result, this would not
work too well since all scores will only be based on the query that only
contains termA... But since you don't care about that, this should be
get you a big performance gain.
Best regards,
Arjen
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
|