lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmet Arslan <iori...@yahoo.com.INVALID>
Subject Occur.FILTER clarification
Date Tue, 08 Aug 2017 21:02:14 GMT
Hi all,
I am trying to access document lenght statistics of the documents that do not contain a given
term.
I have written following piece of code

BooleanQuery.Builder builder = new BooleanQuery.Builder();builder.add(new MatchAllDocsQuery(),
BooleanClause.Occur.MUST)        .add(new TermQuery(term), BooleanClause.Occur.FILTER);
ScoreDoc[] hits = searcher.search(new ConstantScoreQuery(builder.build()), Integer.MAX_VALUE).scoreDocs;
Javadoc says FILTER is like MUST except that these clauses do not participate in scoring.
I was expecting FILTER behaves like MUST_NO, no? (FILTER-clause is excluded from the result
set)

Also, to disable scoring altogether, is it enough to wrap final boolean query using ConstantQuery?Or
individual clauses should be wrapped to?
MatchAllDocsQuery is already ConstantQuery, right?
Thanks,Ahmet

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