Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 34898 invoked from network); 20 Aug 2004 22:46:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 20 Aug 2004 22:46:46 -0000 Received: (qmail 81868 invoked by uid 500); 20 Aug 2004 22:46:35 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 81831 invoked by uid 500); 20 Aug 2004 22:46:35 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 81818 invoked by uid 99); 20 Aug 2004 22:46:34 -0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=DRUGS_ERECTILE,URIBL_WS_SURBL X-Spam-Check-By: apache.org Received: from [209.228.32.65] (HELO c000.snv.cp.net) (209.228.32.65) by apache.org (qpsmtpd/0.27.1) with SMTP; Fri, 20 Aug 2004 15:46:33 -0700 Received: (cpmta 2232 invoked from network); 20 Aug 2004 15:46:32 -0700 Received: from 24.51.105.179 (HELO ?192.168.1.100?) by smtp.hatcher.net (209.228.32.65) with SMTP; 20 Aug 2004 15:46:32 -0700 X-Sent: 20 Aug 2004 22:46:32 GMT Mime-Version: 1.0 (Apple Message framework v619) In-Reply-To: <20040820223524.ED4AF13E2005@ehatchersolutions.com> References: <20040820223524.ED4AF13E2005@ehatchersolutions.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Erik Hatcher Subject: Re: Custom filter Date: Fri, 20 Aug 2004 18:46:29 -0400 To: "Lucene Users List" X-Mailer: Apple Mail (2.619) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Have you considered using the built-in QueryFilter for this? Why isn't it sufficient for your needs? Erik On Aug 20, 2004, at 6:32 PM, roy-lucene-user@xemaps.com wrote: > Hi guys! > > I was hoping someone here could help me out with a custom filter. > > We have an index of emails and do some searches on the text of an > email message and also searches based on the email addresses in a To, > From or CC. > > Since we also do searches on a bunch of emails, we created a custom > filter for searches on an array of fields for an array of values. > [code included below] > > The problem we're having is that creating a query string like so: > "Message:viagra AND (From:(email1 OR email2) OR To:(email1 OR email2) > OR CC:(email1 OR email2))" > would return results, but our filter combined with a query string of > "Message:viagra" sometimes wouldn't. > > One thing I noticed is that when the results do return with the > filter, the email has the format of [singlename]@domain.com, but the > one that doesn't has something like [firstname].[lastname]@domain.com. > > Also it might have something to do with the storage of the From or To > or CC. We don't parse out the email addresses before storing them. > So sometimes the value of a From/To/CC field might be > "local@domain.com" or "local " or even > "". Could the carrots be throwing off my filter? > > I also wouldn't mind any suggestions to doing this filter better. > > Here is the bits method from our custom filter: > --------------------------------------------------------- > final public BitSet bits( IndexReader reader ) throws IOException { > BitSet bits = new BitSet( reader.maxDoc() ); > > for ( int x = 0; x < fields.length; x++ ) { > for ( int y = 0; y < values.length; y++ ) { > TermDocs termDocs = reader.termDocs( new Term( > fields[x], values[y] ) ); > try { > while ( termDocs.next() ) { > bits.set( termDocs.doc() ); > } > } > finally { > termDocs.close(); > } > } > } > return bits; > } > --------------------------------------------------------- > > Thanks in advance, > > Roy. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: lucene-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org