You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael Pichler (JIRA)" <ji...@apache.org> on 2016/09/07 11:00:28 UTC

[jira] [Commented] (LUCENE-7437) QueryParser with wildcard search does not use Analyzer's tokenizer

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

Michael Pichler commented on LUCENE-7437:
-----------------------------------------

The attached test program uses a SimpleAnalyzer (which has a LowerCaseTokenizer) to add a field value "qwert_asdfghjkl", which produes two words.

All test searches work as expected, except those where special characters (like underscore or percent sign) are used together with a wildcard (asterisk).

Without wildcard the query is tokenized as expected (thus whitespace and separator characters work in the query), however with wildcards the query is no longer tokenized and only whitespaces between searched words/prefixes yield a search result.

{noformat}
search: 'qwert asdfghjkl', query: '+f:qwert +f:asdfghjkl', #hits: 1
search: 'qwert_asdfghjkl', query: '+f:qwert +f:asdfghjkl', #hits: 1
search: 'qwert%asdfghjkl', query: '+f:qwert +f:asdfghjkl', #hits: 1
search: 'qwert asdf*', query: '+f:qwert +f:asdf*', #hits: 1
search: 'qwert_asdf*', query: 'f:qwert_asdf*', #hits: 0
  ^^^ expected 1 hit(s), got 0
search: 'qwert%asdf*', query: 'f:qwert%asdf*', #hits: 0
  ^^^ expected 1 hit(s), got 0
{noformat}


> QueryParser with wildcard search does not use Analyzer's tokenizer
> ------------------------------------------------------------------
>
>                 Key: LUCENE-7437
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7437
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/queryparser
>    Affects Versions: 6.2
>            Reporter: Michael Pichler
>         Attachments: LuceneTest.java
>
>
> Using a tokenizer that splits at underscores (e.g. SimpleAnalyzer) splits "qwert_asdfghjkl" into two words at the time of indexing.
> Searches for "qwert asdf*" or "qwert_asdfghjkl" work as expected.
> However, when a query contains wildcards, e.g. "qwert_asdf*" the query parser does not use the tokenizer of its analyzer to split the words and thus finds no result.



--
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