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:[EMAIL PROTECTED] 
Sent: Friday, September 15, 2006 07:54 AM
To: java-user@lucene.apache.org
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 [EMAIL PROTECTED]
___________________________
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to