lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Stette <jan.ste...@gmail.com>
Subject Re: Multiple facets in Lucene searches
Date Thu, 22 Nov 2012 11:53:11 GMT
That works great, thanks!

Jan


On 21 November 2012 19:52, Shai Erera <serera@gmail.com> wrote:

> Hi Jan,
>
> Basically, DrillDown is a helper class for creating such queries. You're
> right that its query() methods create AND, because that's normally the
> case, but if you require OR, you could do this:
>
>     BooleanQuery res = new BooleanQuery();
>     for (CategoryPath cp : paths) {
>       res.add(new TermQuery(DrillDown.term(iParams, cp)), Occur.SHOULD);
>     }
>
> I copied the code from DrillDown.query(FacetIndexingParams,
> CategoryPath...) and modified Occur.MUST to Occur.SHOULD.
>
> Can you give it a try?
>
> Shai
>
>
> On Wed, Nov 21, 2012 at 7:27 PM, Jan Stette <jan.stette@gmail.com> wrote:
>
>> Hi,
>>
>> I'm trying to use Lucene Facet for doing faceted searches. I've hit a
>> problem with a use case where users in my application needs to be able to
>> select multiple facets then run a search for things that match either of
>> the facets.
>>
>> Using DrillDown.query(), it treats multiple facets using AND, so that it
>> returns hits that match all of the given facets, as described here:
>>
>> http://lucene.apache.org/core/3_6_1/api/all/org/apache/lucene/facet/search/DrillDown.html
>> .
>>
>> That's good for some use cases, but not for all. Is there a way to specify
>> OR instead of AND for drilldown queries. Alternatively, a way to achieve
>> the same result using another type of query?
>>
>> Regards,
>> Jan
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message