lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From András Péteri <apet...@b2international.com>
Subject Re: Are "position" and "position increment" actually the exact same concept?
Date Mon, 08 Feb 2016 15:39:06 GMT
It's only the naming of FieldQueryNode's property that seems ambiguous to
me. The caller of setPositionIncrement(int), AnalyzerQueryNodeProcessor
[1], computes absolute term positions and stores that value in the
property, not the increments. If the term attribute is not available, it'll
increment the position by 1 for each term/groups of terms.

[1]
https://github.com/apache/lucene-solr/blob/master/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/AnalyzerQueryNodeProcessor.java

On Mon, Feb 8, 2016 at 4:19 PM, Adrien Grand <jpountz@gmail.com> wrote:

> This looks like a bug indeed: position increments should be summed up in
> order to compute positions.
>
> Le mar. 2 févr. 2016 à 02:22, Trejkaz <trejkaz@trypticon.org> a écrit :
>
> > I found the following code in PhraseQueryNodeBuilder:
> >
> >     PhraseQuery.Builder builder = new PhraseQuery.Builder();
> >     List<QueryNode> children = phraseNode.getChildren();
> >     if (children != null) {
> >         for (QueryNode child : children) {
> >             TermQuery termQuery = (TermQuery) child
> >                 .getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
> >             FieldQueryNode termNode = (FieldQueryNode) child;
> >
> >            builder.add(termQuery.getTerm(),
> > termNode.getPositionIncrement());
> >         }
> >     }
> >
> > Note that:
> >     * termNode.getPositionIncrement() returns a "position increment".
> >     * PhraseQuery.Builder.add(Term,int) takes a "position".
> >
> > I thought that "position" and "position increment" were two different
> > things, so I'm confused. Are they actually the same after all?
> >
> > TX
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>

-- 
András Péteri

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