You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by frueskens <fr...@ricoh-europe.com> on 2010/06/25 12:43:49 UTC

searching for wildcard as valid character

Dear all,

I have to solve the following problem but without success yet.

We need to search for a content in a field 'name' that contains the wildcard
symbol appearing somewhere in a string. E.g. indexed string "1234*abc". 
The query should ignore all others that does not contain this symbol. 
A query like "name:*\**" does not work - it finds everything. 

Although if I would search for a symbol like '[' (which is also part of the
query syntax) in "1234[abc" using the query "name:*\[*" finds exactly the
indexed string.

BTW: the string  "1234*abc" was indexed as is - checked with Luke

Any clue?
Thanks
-- 
View this message in context: http://lucene.472066.n3.nabble.com/searching-for-wildcard-as-valid-character-tp921791p921791.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: searching for wildcard as valid character

Posted by frueskens <fr...@ricoh-europe.com>.
Thank you all for your support.

I'm using now RegEx query from Lucene Contrib package which handles it fine
in my unit test. I'm waiting for confirmation from the other developer team
if this fixed their issue.


-- 
View this message in context: http://lucene.472066.n3.nabble.com/searching-for-wildcard-as-valid-character-tp921791p930117.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: searching for wildcard as valid character

Posted by Robert Muir <rc...@gmail.com>.
i just wanted to mention that wildcardquery (forget queryparser) has no way
to allow for an escaped character such as * or ? that is also an operator:

https://issues.apache.org/jira/browse/LUCENE-588

On Fri, Jun 25, 2010 at 7:01 AM, Uwe Schindler <uw...@thetaphi.de> wrote:

> Mybe you simply don't use QueryParser for such types of Queries and
> instantiate TermQuery, BooleanQuery, WildCard, Prefix by hand. Then you
> don't need to take care of syntax, you create unambiguous objects.
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
> > -----Original Message-----
> > From: frueskens [mailto:frueskens@ricoh-europe.com]
> > Sent: Friday, June 25, 2010 12:44 PM
> > To: java-user@lucene.apache.org
> > Subject: searching for wildcard as valid character
> >
> >
> > Dear all,
> >
> > I have to solve the following problem but without success yet.
> >
> > We need to search for a content in a field 'name' that contains the
> wildcard
> > symbol appearing somewhere in a string. E.g. indexed string "1234*abc".
> > The query should ignore all others that does not contain this symbol.
> > A query like "name:*\**" does not work - it finds everything.
> >
> > Although if I would search for a symbol like '[' (which is also part of
> the query
> > syntax) in "1234[abc" using the query "name:*\[*" finds exactly the
> indexed
> > string.
> >
> > BTW: the string  "1234*abc" was indexed as is - checked with Luke
> >
> > Any clue?
> > Thanks
> > --
> > View this message in context:
> > http://lucene.472066.n3.nabble.com/searching-for-wildcard-as-valid-
> > character-tp921791p921791.html
> > Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
Robert Muir
rcmuir@gmail.com

RE: searching for wildcard as valid character

Posted by Uwe Schindler <uw...@thetaphi.de>.
Mybe you simply don't use QueryParser for such types of Queries and
instantiate TermQuery, BooleanQuery, WildCard, Prefix by hand. Then you
don't need to take care of syntax, you create unambiguous objects.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: frueskens [mailto:frueskens@ricoh-europe.com]
> Sent: Friday, June 25, 2010 12:44 PM
> To: java-user@lucene.apache.org
> Subject: searching for wildcard as valid character
> 
> 
> Dear all,
> 
> I have to solve the following problem but without success yet.
> 
> We need to search for a content in a field 'name' that contains the
wildcard
> symbol appearing somewhere in a string. E.g. indexed string "1234*abc".
> The query should ignore all others that does not contain this symbol.
> A query like "name:*\**" does not work - it finds everything.
> 
> Although if I would search for a symbol like '[' (which is also part of
the query
> syntax) in "1234[abc" using the query "name:*\[*" finds exactly the
indexed
> string.
> 
> BTW: the string  "1234*abc" was indexed as is - checked with Luke
> 
> Any clue?
> Thanks
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/searching-for-wildcard-as-valid-
> character-tp921791p921791.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: searching for wildcard as valid character

Posted by tarun sapra <t....@gmail.com>.
TermQuery should solve your problem as it would consider "1234*abc" as one
single term.

Regards
Tarun Sapra

On Fri, Jun 25, 2010 at 4:13 PM, frueskens <fr...@ricoh-europe.com>wrote:

>
> Dear all,
>
> I have to solve the following problem but without success yet.
>
> We need to search for a content in a field 'name' that contains the
> wildcard
> symbol appearing somewhere in a string. E.g. indexed string "1234*abc".
> The query should ignore all others that does not contain this symbol.
> A query like "name:*\**" does not work - it finds everything.
>
> Although if I would search for a symbol like '[' (which is also part of the
> query syntax) in "1234[abc" using the query "name:*\[*" finds exactly the
> indexed string.
>
> BTW: the string  "1234*abc" was indexed as is - checked with Luke
>
> Any clue?
> Thanks
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/searching-for-wildcard-as-valid-character-tp921791p921791.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>