lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Huber <gregh3...@gmail.com>
Subject version 4.10.3 AnalyzingInfixSuggester with multiple contexts
Date Fri, 09 Jan 2015 16:21:19 GMT
Hello,

I am trying to use multiple contexts on the
org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester but
there is a mistake on the CONTEXTS_FIELD_NAME, the
BooleanClause.Occur.SHOULD needs to be BooleanClause.Occur.MUST. ( see
<<<<<<<<<<<<<<<<<< below)

I noticed that its been fixed on the trunk but not on the current release.
Does this mean its not going to be fixed on the 4.x.x release?

version  4.10.3

...
if (contexts != null) {
                BooleanQuery sub = new BooleanQuery();
                query.add(sub, BooleanClause.Occur.MUST);
                for (BytesRef context : contexts) {
                    // NOTE: we "should" wrap this in
                    // ConstantScoreQuery, or maybe send this as a
                    // Filter instead to search, but since all of
                    // these are MUST'd, the change to the score won't
                    // affect the overall ranking. Since we indexed
                    // as DOCS_ONLY, the perf should be the same
                    // either way (no freq int[] blocks to decode):

                    // TODO: if we had a BinaryTermField we could fix
                    // this "must be valid ut8f" limitation:
                    sub.add(new TermQuery(new Term(CONTEXTS_FIELD_NAME,
context
                            .utf8ToString())),
BooleanClause.Occur.SHOULD);  <<<<<<<<<<<<<<<<<<
                }
            }
..

trunk:

..
// do not make a subquery if all context booleans are must not
        if (allMustNot == true) {
          for (Map.Entry<BytesRef, BooleanClause.Occur> entry :
contextInfo.entrySet()) {
            query.add(new TermQuery(new Term(CONTEXTS_FIELD_NAME,
entry.getKey().utf8ToString())), BooleanClause.Occur.MUST_NOT);
          }

        } else {
          BooleanQuery sub = new BooleanQuery();
          query.add(sub, BooleanClause.Occur.MUST); <<<<<<<<<<<<<<<<<<
fixed!

          for (Map.Entry<BytesRef, BooleanClause.Occur> entry :
contextInfo.entrySet()) {
            // NOTE: we "should" wrap this in
            // ConstantScoreQuery, or maybe send this as a
            // Filter instead to search.

            // TODO: if we had a BinaryTermField we could fix
            // this "must be valid ut8f" limitation:
            sub.add(new TermQuery(new Term(CONTEXTS_FIELD_NAME,
entry.getKey().utf8ToString())), entry.getValue());
          }
        }
..

Cheers Greg

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