You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "David Smiley (JIRA)" <ji...@apache.org> on 2015/11/23 14:23:11 UTC

[jira] [Commented] (LUCENE-6801) PhraseQuery incorrectly advertises it supports terms at the same position

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

David Smiley commented on LUCENE-6801:
--------------------------------------

I'll commit this in a few hours. It'll be nice to have these docs finally reflect what's going on here.

My only lingering concern is that this "feature" of PhraseQuery seems so hidden (not documented till now) and weird (would anyone actually want this behavior?), that I wonder if it should be supported at all.  If this feature is brought to light then it makes MultiPhraseQuery seem like a misnomer... PhraseQuery _also_ supports multiple terms at the same position but simply doesn't have the same convenience method and has different semantics.  Shrug.  Any way, at least document and test the behavior than pretend it's no there.

> PhraseQuery incorrectly advertises it supports terms at the same position
> -------------------------------------------------------------------------
>
>                 Key: LUCENE-6801
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6801
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/search
>            Reporter: David Smiley
>            Priority: Minor
>         Attachments: LUCENE_6801.patch, LUCENE_6801.patch
>
>
> The following in PhraseQuery has been here since Sept 15th 2004 (by "goller"):
> {code:java}
>     /**
>      * Adds a term to the end of the query phrase.
>      * The relative position of the term within the phrase is specified explicitly.
>      * This allows e.g. phrases with more than one term at the same position
>      * or phrases with gaps (e.g. in connection with stopwords).
>      * 
>      */
>     public Builder add(Term term, int position) {
> {code}
> Of course this isn't true; it's why we have MultiPhraseQuery.  Yet we even allow you to have consecutive terms with the same positions.  We shouldn't allow that; we should throw an exception.  For my own sanity, I modified a simple MultiPhraseQuery test to use PhraseQuery instead and of course it didn't work.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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