[
https://issues.apache.org/jira/browse/LUCENE-588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546969
]
Hoss Man commented on LUCENE-588:
---------------------------------
you're refering to the documentation for the querysyntax, used by the
QueryParser ... which is in fact true: you can \ escape both * and ? as far as
the QueryParser goes -- but the WildcardQuery class doesn't support (nor does
it's documentation advertise) any escape characters.
In a nut shell: you can escape the characters so QueryParser doesn't consider
them wildcards -- which will influence whether or not QP builds a WIldcardQuery
or a TermQuery, but WildcardQuery doesn't know or care about escape characters.
Consider these examples, and assume a whitespace analyzer....
{code}
parse("lucene") -> new TermQuery("lucene")
parse("lu?ene") -> new WIldcardQuery("lu?ene")
parse("lu\?ene") -> new TermQuery("lu?ene")
parse("lu\?e?e") -> new WIldcardQuery("lu?e?e")
parse("lu\?e\?e") -> new TermQuery("lu?e?e")
{code}
that's why it works the way it does.
as for how to improve it: It seems reasonable for WildcardQuery to have a
boolean constructor arg indicating whether or not it should respect "standard"
backslash escape sequences ... and then QueryParser could have an option to
pass the "raw" string (with escapes) to this new constructor.
> Escaped wildcard character in wildcard term not handled correctly
> -----------------------------------------------------------------
>
> Key: LUCENE-588
> URL: https://issues.apache.org/jira/browse/LUCENE-588
> Project: Lucene - Java
> Issue Type: Bug
> Components: QueryParser
> Affects Versions: 2.0.0
> Environment: Windows XP SP2
> Reporter: Sunil Kamath
>
> If an escaped wildcard character is specified in a wildcard query, it is
> treated as a wildcard instead of a literal.
> e.g., t\??t is converted by the QueryParser to t??t - the escape character is
> discarded.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]