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

Adriano Crestani commented on LUCENE-5344:
------------------------------------------

Good catch Michael! I had the change, I just missed it during the commit (not 
sure how).

> Flexible StandardQueryParser behaves differently than ClassicQueryParser
> ------------------------------------------------------------------------
>
>                 Key: LUCENE-5344
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5344
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/queryparser
>    Affects Versions: 4.5
>            Reporter: Krishna Keldec
>            Assignee: Adriano Crestani
>             Fix For: 5.0, 4.7
>
>         Attachments: LUCENE-5344_adrianocrestani_2014-01-12.patch, 
> LUCENE-5344_adrianocrestani_2014-01-14.patch, 
> LUCENE-5344_adrianocrestani_2014-01-14_branch_4x.patch
>
>
> AnalyzerQueryNodeProcessor creates a BooleanQueryNode instead of a 
> MultiPhraseQueryNode for some circumstances.
> Classic query parser output: {{+content:a +content:320}}  *(correct)*
> {code:java}
> QueryParser classicQueryParser;
> classicQueryParser = new QueryParser(Version.LUCENE_45, "content", anaylzer);
> classicQueryParser.setDefaultOperator(Operator.AND);
> classicQueryParser.parse("a320"));
> {code}
> Flexible query parser output: {{content:a content:320}} *(wrong)*
> {code:java}
> StandardQueryParser flexibleQueryParser;
> flexibleQueryParser = new StandardQueryParser(anaylzer);
> flexibleQueryParser.setDefaultOperator(Operator.AND);
> flexibleQueryParser.parse("a320", "content"));
> {code}
> The used analyzer:
> {code:java}
> Analyzer anaylzer = return new Analyzer() {
>   protected TokenStreamComponents createComponents(String field, Reader in) {
>   Tokenizer   src = new WhitespaceTokenizer(Version.LUCENE_45, in);
>   TokenStream tok = new WordDelimiterFilter(src,
>      WordDelimiterFilter.SPLIT_ON_NUMERICS |
>      WordDelimiterFilter.GENERATE_WORD_PARTS |
>      WordDelimiterFilter.GENERATE_NUMBER_PARTS,
>      CharArraySet.EMPTY_SET); 
>   return new TokenStreamComponents(src, tok);
> };
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to