FAQ
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

Search Discussions

  • Uwe Schindler at Jun 25, 2010 at 11:02 am
    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
    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 at Jun 25, 2010 at 8:16 pm
    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 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
    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
  • Frueskens at Jun 29, 2010 at 8:42 am
    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
  • Tarun sapra at Jun 25, 2010 at 11:33 am
    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 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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedJun 25, '10 at 10:44a
activeJun 29, '10 at 8:42a
posts5
users4
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase