Praveen Peddi writes:
> 
> Does it makes sense to call docFreq or termDocs (which ever is faster) before 
> calling delete?
> 
IMO no.

calling termDocs is what Reader.delete(Term) does:

  public final int delete(Term term) throws IOException {
    TermDocs docs = termDocs(term);
    if (docs == null) return 0;
    int n = 0;
    try {
      while (docs.next()) {
        delete(docs.doc());
        n++;
      }
    } finally {
      docs.close();
    }
    return n;
  }

(the advantage of OSS is, that you can look into it's sources)

So it already uses termDocs to see if there's anything to do.
I doubt that using docFreq would be much faster. In both cases the
term is searched and -- if you don't have to delete anything -- not
found. If it's found, docFreq might be faster, but in that case you have
to delete and use termDocs anyway.

Morus

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

Reply via email to