lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Condit <con...@sdsc.edu>
Subject RE: Modify TermQueries or Tokens
Date Fri, 30 Apr 2010 21:08:06 GMT
Hi Lisheng-
>> 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?

> 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

What about a more complex query string like: (foo OR nacho) AND ("bar baz") OR cheese~1.2.
If I feed this to the MultiFieldQueryParser can I change the TermQueries afterward? Or am
I going to have write some code to modify the original string?

Thanks for your response,
-Chris

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