Anton Potehin wrote:
Now I create new search for get number of results. For example:

IndexSearcher is = ...

Query q = ...
numberOfResults = Is.search(q).length();

Can I accelerate this example ? And how ?

Perhaps something like:

class CountingHitCollector
  implements HitCollector
{
  public int count;

  public void collect(int doc, float score)
  {
    if (score > 0.0f)
      ++count;
  }
}

...

CountingHitCollector c = new CountingHitCollector();
searcher.search(query, c);
int hits = c.count;


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

Reply via email to