mirror of https://github.com/apache/lucene.git
SOLR-3078: only return update versions on request
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1239437 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
49799e031f
commit
f6e4fceda2
|
@ -107,7 +107,7 @@ public class FunctionQuery extends Query {
|
|||
final float qWeight;
|
||||
int doc=-1;
|
||||
final FunctionValues vals;
|
||||
final Bits liveDocs;
|
||||
final Bits acceptDocs;
|
||||
|
||||
public AllScorer(AtomicReaderContext context, Bits acceptDocs, FunctionWeight w, float qWeight) throws IOException {
|
||||
super(w);
|
||||
|
@ -115,7 +115,7 @@ public class FunctionQuery extends Query {
|
|||
this.qWeight = qWeight;
|
||||
this.reader = context.reader();
|
||||
this.maxDoc = reader.maxDoc();
|
||||
this.liveDocs = acceptDocs;
|
||||
this.acceptDocs = acceptDocs;
|
||||
vals = func.getValues(weight.context, context);
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class FunctionQuery extends Query {
|
|||
if (doc>=maxDoc) {
|
||||
return doc=NO_MORE_DOCS;
|
||||
}
|
||||
if (liveDocs != null && !liveDocs.get(doc)) continue;
|
||||
if (acceptDocs != null && !acceptDocs.get(doc)) continue;
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
|
|||
import org.apache.solr.common.cloud.ZooKeeperException;
|
||||
import org.apache.solr.common.params.CoreAdminParams.CoreAdminAction;
|
||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.params.UpdateParams;
|
||||
import org.apache.solr.common.util.Hash;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.core.CoreDescriptor;
|
||||
|
@ -112,7 +113,7 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
|
|||
this.ulog = updateHandler.getUpdateLog();
|
||||
this.vinfo = ulog == null ? null : ulog.getVersionInfo();
|
||||
versionsStored = this.vinfo != null && this.vinfo.getVersionField() != null;
|
||||
returnVersions = versionsStored;
|
||||
returnVersions = req.getParams().getBool(UpdateParams.VERSIONS ,false);
|
||||
|
||||
// TODO: better way to get the response, or pass back info to it?
|
||||
SolrRequestInfo reqInfo = returnVersions ? SolrRequestInfo.getRequestInfo() : null;
|
||||
|
|
|
@ -61,4 +61,7 @@ public interface UpdateParams
|
|||
public static final String MAX_OPTIMIZE_SEGMENTS = "maxSegments";
|
||||
|
||||
public static final String EXPUNGE_DELETES = "expungeDeletes";
|
||||
|
||||
/** Return versions of updates? */
|
||||
public static final String VERSIONS = "versions";
|
||||
}
|
||||
|
|
|
@ -834,6 +834,11 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
|
||||
|
||||
public static Long addAndGetVersion(SolrInputDocument sdoc, SolrParams params) throws Exception {
|
||||
if (params==null || params.get("versions") == null) {
|
||||
ModifiableSolrParams mparams = new ModifiableSolrParams(params);
|
||||
mparams.set("versions","true");
|
||||
params = mparams;
|
||||
}
|
||||
String response = updateJ(jsonAdd(sdoc), params);
|
||||
Map rsp = (Map)ObjectBuilder.fromJSON(response);
|
||||
List lst = (List)rsp.get("adds");
|
||||
|
@ -842,6 +847,11 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
}
|
||||
|
||||
public static Long deleteAndGetVersion(String id, SolrParams params) throws Exception {
|
||||
if (params==null || params.get("versions") == null) {
|
||||
ModifiableSolrParams mparams = new ModifiableSolrParams(params);
|
||||
mparams.set("versions","true");
|
||||
params = mparams;
|
||||
}
|
||||
String response = updateJ(jsonDelId(id), params);
|
||||
Map rsp = (Map)ObjectBuilder.fromJSON(response);
|
||||
List lst = (List)rsp.get("deletes");
|
||||
|
@ -850,6 +860,11 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
}
|
||||
|
||||
public static Long deleteByQueryAndGetVersion(String q, SolrParams params) throws Exception {
|
||||
if (params==null || params.get("versions") == null) {
|
||||
ModifiableSolrParams mparams = new ModifiableSolrParams(params);
|
||||
mparams.set("versions","true");
|
||||
params = mparams;
|
||||
}
|
||||
String response = updateJ(jsonDelQ(q), params);
|
||||
Map rsp = (Map)ObjectBuilder.fromJSON(response);
|
||||
List lst = (List)rsp.get("deleteByQuery");
|
||||
|
|
Loading…
Reference in New Issue