tags:

views:

100

answers:

2

Hi,

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

Thanks!

A: 

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

rz
A: 

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/ http://stackoverflow.com/questions/66041/how-to-sort-by-lucene-net-field-and-ignore-common-stop-words-such-as-a-and-the

Tyzak