You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Alan Woodward (Jira)" <ji...@apache.org> on 2020/05/07 15:36:00 UTC
[jira] [Commented] (LUCENE-9367) Using a queryText which results in
zero tokens causes a query to be built as null
[ https://issues.apache.org/jira/browse/LUCENE-9367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17101786#comment-17101786 ]
Alan Woodward commented on LUCENE-9367:
---------------------------------------
`null` does seem like the wrong thing to do here - maybe we should be returning a MatchNoDocsQuery instead?
> Using a queryText which results in zero tokens causes a query to be built as null
> ---------------------------------------------------------------------------------
>
> Key: LUCENE-9367
> URL: https://issues.apache.org/jira/browse/LUCENE-9367
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/search
> Affects Versions: 7.2.1
> Reporter: Tim Brier
> Priority: Major
>
> If a queryText produces zero tokens after being processed by an Analyzer, when you try to build a Query with it the result is null.
>
> The following code reproduces this bug:
> {code:java}
> public class LuceneBug {
> public Query buildQuery() throws IOException {
> Analyzer analyzer = CustomAnalyzer.builder()
> .withTokenizer(StandardTokenizerFactory.class)
> .addTokenFilter(StopFilterFactory.class)
> .build();
> QueryBuilder queryBuilder = new QueryBuilder(analyzer);
> String onlyStopWords = "the and it";
> return queryBuilder.createPhraseQuery("AnyField", onlyStopWords);
> }
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org