user41625
user41625

Reputation: 307

"Exclude these words" feature

How do I implement "Exclude these words" feature for a search appliation using Lucene?

Thanks!

Upvotes: 0

Views: 1701

Answers (2)

Tyzak
Tyzak

Reputation: 2438

therefor i can use the stopanalyzer:

StopAnalyzer StopAnalyzer includes the lower-case filter, and also has a filter that drops out any "stop words", words like articles (a, an, the, etc) that occur so commonly in english that they might as well be noise for searching purposes. StopAnalyzer comes with a set of stop words, but you can instantiate it with your own array of stop words.

http://lucene.apache.org/java/2_3_0/api/org/apache/lucene/analysis/StopAnalyzer.html

more information: http://www.darksleep.com/lucene/ How to sort by Lucene.Net field and ignore common stop words such as 'a' and 'the'?

Upvotes: 1

rz.
rz.

Reputation: 20037

Look at the NOT operator here. Just construct your query accordingly or massage if it is a user-generated query.

Upvotes: 0

Related Questions