One point: if you use stemming, or some other modification of the terms before indexing, you'll need to make sure the terms you create to match against are also stemmed.
Greg ----- Original Message ---- From: Greg Gershman <[EMAIL PROTECTED]> To: java-user@lucene.apache.org Sent: Wednesday, March 7, 2007 11:02:51 AM Subject: Re: Negative Filtering (such as for profanity) Thanks! I was not aware of that class, for some reason. I tried creating a NegativeQueryFilter, it works just fine. Can you think of any reason why one approach would be better than the other? If there's interest, I'm happy to post the NegativeQueryFilter. Greg ----- Original Message ---- From: Mark Miller <[EMAIL PROTECTED]> To: java-user@lucene.apache.org Sent: Wednesday, March 7, 2007 10:19:32 AM Subject: Re: Negative Filtering (such as for profanity) http://lucene.apache.org/java/docs/api/org/apache/lucene/search/MatchAllDocsQuery.html You can use that Query in front of a NOT query clause. Greg Gershman wrote: > I'm attempting to create a profanity filter. I thought to use a QueryFilter > created with a Query of (-$#!+ AND [EMAIL PROTECTED] AND etc). The problem I > have run into is that, as a pure negative query is not supported (a query for > (-term) DOES NOT return the inverse of a query for (term)), I believe the bit > set returned by a purely negative QueryFilter is empty, so no matter how many > results returned by the initial query, the result after filtering is always > zero documents. > > I was wondering if anyone had suggestions as to how else to do this. I've > considered simply amending the query string submitted by the user to include > a pre-generated String that would exclude the query terms, but I consider > this a non-elegant solution. I had also thought about creating a new > sub-class of QueryFilter, NegativeQueryFilter. Basically, it would works > just like a QueryFilter, taking a positive query (so, I would pass it an > OR'ed list of profane words), then the resulting bits are simply flipped. I > think this would work, unless I'm missing something. I'm going to experiment > with it, I'd appreciate anyone's thoughts on this. > > Thanks, > > Greg > > > > > > ____________________________________________________________________________________ > It's here! Your new message! > Get new email alerts with the free Yahoo! Toolbar. > http://tools.search.yahoo.com/toolbar/features/mail/ > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ____________________________________________________________________________________ Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news