lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Custom filter
Date Fri, 20 Aug 2004 22:46:29 GMT
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 <local@domain.com>" or even 
> "<local@domain.com>".  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


Mime
View raw message