Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Term positions in analyze API should start at 1, not 0 #10771

Closed

Conversation

johtani
Copy link
Contributor

@johtani johtani commented Apr 24, 2015

Now, Analyze API return 1 as 1st token.
Analyze API should return 0 as 1st token, looks like TermVector.

@dakrone
Copy link
Member

dakrone commented Apr 24, 2015

LGTM

@clintongormley
Copy link

@johtani Let's make this change only master - it's a breaking change.

@johtani
Copy link
Contributor Author

johtani commented Apr 27, 2015

@clintongormley I see.
I add comment to breaking changes 2.0 doc.

int increment = posIncr.getPositionIncrement();
if (increment > 0) {
position = position + increment;
}
tokens.add(new AnalyzeResponse.AnalyzeToken(term.toString(), position, offset.startOffset(), offset.endOffset(), type.type()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look correct to me: of course would be analyzer as a single token course at position 0 while it should be at position 1.

I think the right fix is to put back tokens.add where it was before and instead to initialize position at -1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@johtani
Copy link
Contributor Author

johtani commented Apr 28, 2015

@jpountz Fix your comment and add the test .

@jpountz
Copy link
Contributor

jpountz commented Apr 28, 2015

LGTM. Thanks @johtani !

@johtani johtani force-pushed the fix/wrong_position_returned_analyze_api branch 2 times, most recently from f8efba7 to ca3d941 Compare April 28, 2015 08:19
@johtani johtani removed the review label Apr 28, 2015
@johtani johtani closed this Apr 28, 2015
@johtani johtani force-pushed the fix/wrong_position_returned_analyze_api branch from ca3d941 to 933edf7 Compare April 28, 2015 08:46
@clintongormley clintongormley changed the title Analysis: Fix wrong position number by analyze API Term positions in analyze API should start at 1, not 0 Jun 6, 2015
@johtani johtani deleted the fix/wrong_position_returned_analyze_api branch April 25, 2016 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants