[ https://issues.apache.org/jira/browse/LUCENE-588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12599630#action_12599630 ]
Michael Busch commented on LUCENE-588: -------------------------------------- I think we should add a new constructor to WildcardQuery like this: {code:java} public WildcardQuery(Term term) { this(term, WildcardTermEnum.WILDCARD_CHAR, WildcardTermEnum.WILDCARD_STRING); } public WildcardQuery(Term term, char wildcardChar, char wildcardString) { super(term); this.wildcardChar = wildcardChar; this.wildcardString = wildcardString; this.termContainsWildcard = (term.text().indexOf(wildcardChar) != -1) || (term.text().indexOf(wildcardString) != -1); } {code} Then the WildcardQuery doesn't need to know anything about escaping and the QueryParser can just map wildcard characters that weren't escaped to some other unused chars and can unescape * and ? chars. The only disadvantage of this design would be that the WildcardQuery.toString() would not produce a String anymore that the QueryParser could parse. However, I think the requirement of Query.toString() to produce a parseable String is not very good anyways, because it adds a dependency between the Query classes and the QueryParser. I'd prefer to add a method like: {code:java} String toQueryString(Query); {code} to the QueryParser. Then Query.toString() wouldn't be tied anymore to a specific QueryParser implementation and syntax. Thoughts? Terry are you still around? Would you like to work on a new patch here? > 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 > Assignee: Michael Busch > Priority: Minor > Attachments: LUCENE-588.patch > > > 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]