mirror of https://github.com/apache/lucene.git
clean up comments and unnecessary inits
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1152506 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
135d89c4bd
commit
b2e6d30243
|
@ -148,12 +148,9 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
||||||
// still inc softCommit
|
// still inc softCommit
|
||||||
softCommitTracker.docsSinceCommit++;
|
softCommitTracker.docsSinceCommit++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is the only unsynchronized code in the iwAccess block, which
|
|
||||||
// should account for most of the time
|
|
||||||
Term updateTerm = null;
|
|
||||||
|
|
||||||
if (cmd.overwrite) {
|
if (cmd.overwrite) {
|
||||||
|
Term updateTerm;
|
||||||
Term idTerm = new Term(idField.getName(), cmd.getIndexedId());
|
Term idTerm = new Term(idField.getName(), cmd.getIndexedId());
|
||||||
boolean del = false;
|
boolean del = false;
|
||||||
if (cmd.updateTerm == null) {
|
if (cmd.updateTerm == null) {
|
||||||
|
@ -189,7 +186,7 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// could return the number of docs deleted, but is that always possible to know???
|
// we don't return the number of docs deleted because it's not always possible to quickly know that info.
|
||||||
@Override
|
@Override
|
||||||
public void delete(DeleteUpdateCommand cmd) throws IOException {
|
public void delete(DeleteUpdateCommand cmd) throws IOException {
|
||||||
deleteByIdCommands.incrementAndGet();
|
deleteByIdCommands.incrementAndGet();
|
||||||
|
@ -204,16 +201,14 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// why not return number of docs deleted?
|
// we don't return the number of docs deleted because it's not always possible to quickly know that info.
|
||||||
// Depending on implementation, we may not be able to immediately determine the num...
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByQuery(DeleteUpdateCommand cmd) throws IOException {
|
public void deleteByQuery(DeleteUpdateCommand cmd) throws IOException {
|
||||||
deleteByQueryCommands.incrementAndGet();
|
deleteByQueryCommands.incrementAndGet();
|
||||||
deleteByQueryCommandsCumulative.incrementAndGet();
|
deleteByQueryCommandsCumulative.incrementAndGet();
|
||||||
boolean madeIt=false;
|
boolean madeIt=false;
|
||||||
boolean delAll=false;
|
|
||||||
try {
|
try {
|
||||||
Query q = null;
|
Query q;
|
||||||
try {
|
try {
|
||||||
QParser parser = QParser.getParser(cmd.query, "lucene", cmd.req);
|
QParser parser = QParser.getParser(cmd.query, "lucene", cmd.req);
|
||||||
q = parser.getQuery();
|
q = parser.getQuery();
|
||||||
|
@ -221,7 +216,7 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
||||||
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
|
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
delAll = MatchAllDocsQuery.class == q.getClass();
|
boolean delAll = MatchAllDocsQuery.class == q.getClass();
|
||||||
|
|
||||||
if (delAll) {
|
if (delAll) {
|
||||||
deleteAll();
|
deleteAll();
|
||||||
|
@ -248,7 +243,7 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
||||||
@Override
|
@Override
|
||||||
public int mergeIndexes(MergeIndexesCommand cmd) throws IOException {
|
public int mergeIndexes(MergeIndexesCommand cmd) throws IOException {
|
||||||
mergeIndexesCommands.incrementAndGet();
|
mergeIndexesCommands.incrementAndGet();
|
||||||
int rc = -1;
|
int rc;
|
||||||
|
|
||||||
log.info("start " + cmd);
|
log.info("start " + cmd);
|
||||||
|
|
||||||
|
@ -308,10 +303,7 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
||||||
if (cmd.optimize) {
|
if (cmd.optimize) {
|
||||||
callPostOptimizeCallbacks();
|
callPostOptimizeCallbacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
// open a new searcher in the sync block to avoid opening it
|
|
||||||
// after a deleteByQuery changed the index, or in between deletes
|
|
||||||
// and adds of another commit being done.
|
|
||||||
if (cmd.softCommit) {
|
if (cmd.softCommit) {
|
||||||
core.getSearcher(true,false,waitSearcher, true);
|
core.getSearcher(true,false,waitSearcher, true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -338,7 +330,7 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are supposed to wait for the searcher to be registered, then we should do it
|
// if we are supposed to wait for the searcher to be registered, then we should do it
|
||||||
// outside of the synchronized block so that other update operations can proceed.
|
// outside any synchronized block so that other update operations can proceed.
|
||||||
if (waitSearcher!=null && waitSearcher[0] != null) {
|
if (waitSearcher!=null && waitSearcher[0] != null) {
|
||||||
try {
|
try {
|
||||||
waitSearcher[0].get();
|
waitSearcher[0].get();
|
||||||
|
|
Loading…
Reference in New Issue