mirror of https://github.com/apache/lucene.git
SOLR-796 -- remove unused SolrIndexSearcher from DUH2. (no CHANGES.txt since not relevant for users)
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@701138 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b34bc9cfcc
commit
2c27d57ec2
|
@ -37,7 +37,6 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.apache.solr.search.SolrIndexSearcher;
|
||||
import org.apache.solr.search.QueryParsing;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
|
@ -140,7 +139,6 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
|||
protected final Lock iwAccess, iwCommit;
|
||||
|
||||
protected IndexWriter writer;
|
||||
protected SolrIndexSearcher searcher;
|
||||
|
||||
public DirectUpdateHandler2(SolrCore core) throws IOException {
|
||||
super(core);
|
||||
|
@ -156,7 +154,6 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
|||
private void deleteAll() throws IOException {
|
||||
core.log.info(core.getLogId()+"REMOVING ALL DOCUMENTS FROM INDEX");
|
||||
closeWriter();
|
||||
closeSearcher();
|
||||
writer = createMainIndexWriter("DirectUpdateHandler2", true);
|
||||
}
|
||||
|
||||
|
@ -179,22 +176,6 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
|||
}
|
||||
}
|
||||
|
||||
protected void openSearcher() throws IOException {
|
||||
if (searcher==null) {
|
||||
searcher = core.newSearcher("DirectUpdateHandler2");
|
||||
}
|
||||
}
|
||||
|
||||
protected void closeSearcher() throws IOException {
|
||||
try {
|
||||
if (searcher!=null) searcher.close();
|
||||
} finally {
|
||||
// if an exception causes a lock to not be
|
||||
// released, we could try to delete it.
|
||||
searcher=null;
|
||||
}
|
||||
}
|
||||
|
||||
public int addDoc(AddUpdateCommand cmd) throws IOException {
|
||||
addCommands.incrementAndGet();
|
||||
addCommandsCumulative.incrementAndGet();
|
||||
|
@ -216,7 +197,6 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
|||
// protected with iwCommit (which iwAccess excludes from this block).
|
||||
synchronized (this) {
|
||||
// adding document -- prep writer
|
||||
closeSearcher();
|
||||
openWriter();
|
||||
tracker.addedDocument();
|
||||
} // end synchronized block
|
||||
|
@ -267,7 +247,6 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
|||
|
||||
iwCommit.lock();
|
||||
try {
|
||||
closeSearcher();
|
||||
openWriter();
|
||||
writer.deleteDocuments(idTerm.createTerm(idFieldType.toInternal(cmd.id)));
|
||||
} finally {
|
||||
|
@ -307,7 +286,6 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
|||
if (delAll) {
|
||||
deleteAll();
|
||||
} else {
|
||||
closeSearcher();
|
||||
openWriter();
|
||||
writer.deleteDocuments(q);
|
||||
}
|
||||
|
@ -349,12 +327,10 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
|||
log.info("start "+cmd);
|
||||
|
||||
if (cmd.optimize) {
|
||||
closeSearcher();
|
||||
openWriter();
|
||||
writer.optimize(cmd.maxOptimizeSegments);
|
||||
}
|
||||
|
||||
closeSearcher();
|
||||
closeWriter();
|
||||
|
||||
callPostCommitCallbacks();
|
||||
|
@ -405,7 +381,6 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
|||
tracker.pending = null;
|
||||
}
|
||||
tracker.scheduler.shutdown();
|
||||
closeSearcher();
|
||||
closeWriter();
|
||||
} finally {
|
||||
iwCommit.unlock();
|
||||
|
|
Loading…
Reference in New Issue