>for hte love of all
> that is sane use a
> Filter instead of putting all those categories in
> your Query.

Try this one:




package org.apache.lucene.search;

import java.io.IOException;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Iterator;

import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs;

/**
 * Constructs a filter for docs matching any of the
terms added to this class
 * @author maharwood
 */
public class TermsFilter extends Filter
{
        ArrayList termsList=new ArrayList();
        
        public void addTerm(Term term)
        {
                termsList.add(term);
        }

        /* (non-Javadoc)
         * @see
org.apache.lucene.search.Filter#bits(org.apache.lucene.index.IndexReader)
         */
        public BitSet bits(IndexReader reader) throws
IOException
        {
                BitSet result=new BitSet(reader.maxDoc());
                for (Iterator iter = termsList.iterator();
iter.hasNext();)
                {
                        Term term = (Term) iter.next();
                        TermDocs td=reader.termDocs(term);
                while (td.next())
                {
                    result.set(td.doc());
                }                                               
                }
                return result;
        }
}





                
___________________________________________________________ 
NEW Yahoo! Cars - sell your car and browse thousands of new and used cars 
online! http://uk.cars.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to