lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-2668) offset gap should be added regardless of existence of tokens in DocInverterPerField
Date Thu, 30 Sep 2010 21:51:34 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-2668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12916696#action_12916696
] 

Michael McCandless commented on LUCENE-2668:
--------------------------------------------

bq. do you know why it conditionally decrements the position and then increments it later
unconditionally? 

This was done in LUCENE-1542, to prevent position increment from becoming negative, which
messes up positions if the field has a payload.  Basically we cannot store a -1 position if
the field has a payload.

But I agree it's awful that we are inconsistent and it requires hacks for apps that have 0
posIncr on the first token.  Not sure how to best fix this though...

> offset gap should be added regardless of existence of tokens in DocInverterPerField
> -----------------------------------------------------------------------------------
>
>                 Key: LUCENE-2668
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2668
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.9.3, 3.0.2, 3.1, 4.0
>            Reporter: Koji Sekiguchi
>            Assignee: Koji Sekiguchi
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2668.patch, LUCENE-2668.patch, LUCENE-2668.patch, Test.java
>
>
> Problem: If a multiValued field which contains a stop word (e.g. "will" in the following
sample) only value is analyzed by StopAnalyzer when indexing, the offsets of the subsequent
tokens are not correct.
> {code:title=indexing a multiValued field}
> doc.add( new Field( F, "Mike", Store.YES, Index.ANALYZED, TermVector.WITH_OFFSETS ) );
> doc.add( new Field( F, "will", Store.YES, Index.ANALYZED, TermVector.WITH_OFFSETS ) );
> doc.add( new Field( F, "use", Store.YES, Index.ANALYZED, TermVector.WITH_OFFSETS ) );
> doc.add( new Field( F, "Lucene", Store.YES, Index.ANALYZED, TermVector.WITH_OFFSETS )
);
> {code}
> In this program (soon to be attached), if you use WhitespaceAnalyzer, you'll get the
offset(start,end) for "use" and "Lucene" will be use(10,13) and Lucene(14,20). But if you
use StopAnalyzer, the offsets will be use(9,12) and lucene(13,19). When searching, since searcher
cannot know what analyzer was used at indexing time, this problem causes out of alignment
of FVH.
> Cause of the problem: StopAnalyzer filters out "will", anyToken flag set to false then
offset gap is not added in DocInverterPerField:
> {code:title=DocInverterPerField.java}
> if (anyToken)
>   fieldState.offset += docState.analyzer.getOffsetGap(field);
> {code}
> I don't understand why the condition is there... If always the gap is added, I think
things are simple.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message