You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Krishna Keldec (JIRA)" <ji...@apache.org> on 2013/11/23 14:20:35 UTC
[jira] [Commented] (LUCENE-5344) Flexible StandardQueryParser
behaves differently than ClassicQueryParser
[ https://issues.apache.org/jira/browse/LUCENE-5344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13830651#comment-13830651 ]
Krishna Keldec commented on LUCENE-5344:
----------------------------------------
As a workaround I have changed the following if-statement in AnalyzerQueryNode:
{code:java}
} else if (severalTokensAtSamePosition || !(node instanceof QuotedFieldQueryNode)) {
// changed || to &&
if (positionCount == 1 && !(node instanceof QuotedFieldQueryNode)) {
// no phrase query:
{code}
> 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
>
> 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#6144)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org