Using wildcard at the start of teh token

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using wildcard at the start of teh token

Supriya Kumar Shyamal
Hello All,

I have a question .. how to use wildcard for searching at the start of
the query string.

For Ex. I want to search on title with query value "*technology", when I
try to create a lucene query by using QueryParser it thorws the
excpetion  ..
Lexical error at line 1, column 1.  Encountered: "*" (42), after : ""

But the other way around is fine like the query "technology*" is a valid
query, just eager to know something like "Like" search in Oracle SQL query.

Kind Regards,
supriya

--
Mit freundlichen Grüßen / Regards
 
Supriya Kumar Shyamal

Software Developer
tel +49 (30) 443 50 99 -22
fax +49 (30) 443 50 99 -99
email [hidden email]
___________________________
artnology GmbH
Milastr. 4
10437 Berlin
___________________________

http://www.artnology.com
__________________________________________________________________________

 News / Aktuelle Projekte:
 * artnology gewinnt Ausschreibung des Bundesministeriums des Innern:
   Softwarelösung für die Verwaltung der Sammlung zeitgenössischer
   Kunstwerke zur kulturellen Repräsentation des Bundes.

 Projektreferenzen:
 * Globaler eShop und Corporate-Site für Springer: www.springeronline.com
 * E-Detailing-Portal für Novartis: www.interaktiv.novartis.de
 * Service-Center-Plattform für Biogen: www.ms-life.de
 * eCRM-System für Grünenthal: www.gruenenthal.com

___________________________________________________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Using wildcard at the start of teh token

Lee_Gary
I believe Lucene's QueryParser doesn't allow you to specify a leading wildcard. However, the WildcardQuery class does allow leading wildcard queries, such as "*technology". This is probably the easiest way to get around this.

You do have other options that can specify a wildcard search, such as using the RegexQuery or SpanRegexQuery classes, which can specify a leading wildcard query if you transform the wildcard notation to a regular expression notation. However, be aware that if your index is large, you can run into the TooManyClauses exception. There are many tricks you can do to get around this, search the forum for TooManyClauses to see what others have done.

Hope this helps!

Regards,
Gary

-----Original Message-----
From: Supriya Kumar Shyamal [mailto:[hidden email]]
Sent: Friday, September 15, 2006 07:54 AM
To: [hidden email]
Subject: Using wildcard at the start of teh token

Hello All,

I have a question .. how to use wildcard for searching at the start of the query string.

For Ex. I want to search on title with query value "*technology", when I try to create a lucene query by using QueryParser it thorws the excpetion  ..
Lexical error at line 1, column 1.  Encountered: "*" (42), after : ""

But the other way around is fine like the query "technology*" is a valid query, just eager to know something like "Like" search in Oracle SQL query.

Kind Regards,
supriya

--
Mit freundlichen Grüßen / Regards
 
Supriya Kumar Shyamal

Software Developer
tel +49 (30) 443 50 99 -22
fax +49 (30) 443 50 99 -99
email [hidden email]
___________________________
artnology GmbH
Milastr. 4
10437 Berlin
___________________________

http://www.artnology.com
__________________________________________________________________________

 News / Aktuelle Projekte:
 * artnology gewinnt Ausschreibung des Bundesministeriums des Innern:
   Softwarelösung für die Verwaltung der Sammlung zeitgenössischer
   Kunstwerke zur kulturellen Repräsentation des Bundes.

 Projektreferenzen:
 * Globaler eShop und Corporate-Site für Springer: www.springeronline.com
 * E-Detailing-Portal für Novartis: www.interaktiv.novartis.de
 * Service-Center-Plattform für Biogen: www.ms-life.de
 * eCRM-System für Grünenthal: www.gruenenthal.com

___________________________________________________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using wildcard at the start of teh token

Erick Erickson
In reply to this post by Supriya Kumar Shyamal
I suspect guarantee that if you have a large index (actually, not that
large), you'll find yourself dealing with TooManyClauses exceptions. Look at
the thread in this list titled "I just don't get wildcards at all" for a
discussion of wildcards and applicable strategies. "The guys" explained a
lot...

Erick

On 9/15/06, Supriya Kumar Shyamal <[hidden email]> wrote:

>
> Hello All,
>
> I have a question .. how to use wildcard for searching at the start of
> the query string.
>
> For Ex. I want to search on title with query value "*technology", when I
> try to create a lucene query by using QueryParser it thorws the
> excpetion  ..
> Lexical error at line 1, column 1.  Encountered: "*" (42), after : ""
>
> But the other way around is fine like the query "technology*" is a valid
> query, just eager to know something like "Like" search in Oracle SQL
> query.
>
> Kind Regards,
> supriya
>
> --
> Mit freundlichen Grüßen / Regards
>
> Supriya Kumar Shyamal
>
> Software Developer
> tel +49 (30) 443 50 99 -22
> fax +49 (30) 443 50 99 -99
> email [hidden email]
> ___________________________
> artnology GmbH
> Milastr. 4
> 10437 Berlin
> ___________________________
>
> http://www.artnology.com
> __________________________________________________________________________
>
> News / Aktuelle Projekte:
> * artnology gewinnt Ausschreibung des Bundesministeriums des Innern:
>    Softwarelösung für die Verwaltung der Sammlung zeitgenössischer
>    Kunstwerke zur kulturellen Repräsentation des Bundes.
>
> Projektreferenzen:
> * Globaler eShop und Corporate-Site für Springer: www.springeronline.com
> * E-Detailing-Portal für Novartis: www.interaktiv.novartis.de
> * Service-Center-Plattform für Biogen: www.ms-life.de
> * eCRM-System für Grünenthal: www.gruenenthal.com
>
>
> ___________________________________________________________________________
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Loading...