karl wettin wrote:

28 feb 2007 kl. 00.49 skrev Russ:

Thanks, I will try it tommorow... Is it significantly different from using a standard index on a ramdir?


A bit different.

You can also try LUCENE-550. It has about the same speed as contrib/memory but can handle multiple documents and use reader, writer and searcher as any other index.

--karl

Karl,

Thank you. I tried the contrib/memory and it's awesome. Got my search time down to 300ms from 5 seconds. I'm still having some performance issues on the set up. I can probably live with them, as I'll be caching these terms, but maybe I can optimize it somehow. It currently takes about 3.5 seconds to set up. I am basically creating 40k SpanNearQueries. Here is my method that creates them. Is there anything I can improve?

private static Analyzer analyzer=new StandardAnalyzer();
public static SpanNearQuery createSpanNearQuery(String string, int slop, boolean inOrder)
   {
       Vector terms=new Vector();
TokenStream tokenizer=Lucene.analyzer.tokenStream("body", new StringReader(string));
       Token token = null;
       do {

           try {
               token=tokenizer.next();
           } catch (Exception e) {
               e.printStackTrace();
           }
           if (token!=null)
           {
terms.add(new SpanTermQuery(new Term("body",token.termText())));
           }
       }
       while (token!=null && terms.size()<10);
SpanTermQuery[] termsArray=new SpanTermQuery[terms.size()];
       for (int i=0;i<terms.size();i++)
       {
           termsArray[i]=(SpanTermQuery) terms.get(i);
       }
       return new SpanNearQuery(termsArray,slop,inOrder);
   }


Russ

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

Reply via email to