lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject Re: Facet DrillDown Exclusion
Date Tue, 06 Dec 2016 14:58:31 GMT
Hey Matt,

You basically don't need to use DDQ in that case. You can construct a
BooleanQuery with a MUST_NOT clause for filter out the facet path. Here's a
short code snippet:

String indexedField = config.getDimConfig("Author").indexFieldName; // Find
the field of the "Author" facet
Query q = new BooleanQuery.Builder()
  .add(new MatchAllDocsQuery(), Occur.MUST) // here you would usually use a
different query
  .add(new TermQuery(DrillDownQuery.term(indexedField, "Author", "Lisa")),
Occur.MUST_NOT) // do not match documents with "Author/Lisa" in their facets
  .build();
searcher.search(q, 10);

Hope this helps

Shai

On Tue, Dec 6, 2016 at 1:55 AM Matt Hicks <matt@outr.com> wrote:

> I'm currently drilling down adding a facet path, but I'd like to be able to
> do the same as a NOT query.  Is there any way to do an exclusion drill down
> on a facet to exclude docs that match the facet while including all others?
>
> Thanks
>

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