lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zhang, Lisheng" <Lisheng.Zh...@BroadVision.com>
Subject RE: Modify TermQueries or Tokens
Date Fri, 30 Apr 2010 20:41:07 GMT
Hi,

Lucene already have class WildcardQuery, I think you can add "*" on either side
(or both), when creating Term:

http://lucene.apache.org/java/3_0_1/api/core/index.html

But notice by default QueryParser cannot parse *queryString.

Best regards, Lisheng

-----Original Message-----
From: Christopher Condit [mailto:condit@sdsc.edu]
Sent: Friday, April 30, 2010 1:11 PM
To: java-user@lucene.apache.org
Subject: Modify TermQueries or Tokens


On a small index that I have I'd like to query certain fields by adding wildcards on either
side of the term: foo -> *foo*. I realize the performance implications but there are some
cases where these terms are crammed together in the indexed content (ie foonacho)  and I need
to be able to return this result when searching for foo or when searching for nacho. I'm curious
what the best way to modify the TermQuery object is. I thought about doing it directly on
the token as it gets parsed, but getNextToken() is final. Then I thought I could iterate over
the TermQueries under the returned Query and change their term, but there's no setTerm method.
Is the only way to do this by modifying the query string? Or is there some more elegant way
to modify the terms in a Query object? Something else I haven't considered?

Thanks,
-Chris

---------------------------------------------------------------------
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


Mime
View raw message