Merge branch 'master' of git://gitorious.org/yacy/rc1.git

pull/1/head
reger 12 years ago
commit 72003b109b

@ -62,6 +62,7 @@ public abstract class AbstractSolrConnector implements SolrConnector {
catchSuccessQuery.setQuery("*:*"); // failreason_t is only available for core collection1
catchSuccessQuery.setFields(CollectionSchema.id.getSolrFieldName());
catchSuccessQuery.clearSorts();
catchSuccessQuery.setIncludeScore(false);
catchSuccessQuery.setRows(0);
catchSuccessQuery.setStart(0);
}
@ -188,9 +189,8 @@ public abstract class AbstractSolrConnector implements SolrConnector {
params.setStart(offset);
params.setFacet(false);
params.clearSorts();
//params.addSortField( "price", SolrQuery.ORDER.asc );
if (fields.length > 0) params.setFields(fields);
params.setIncludeScore(false);
// query the server
QueryResponse rsp = getResponseByParams(params);
@ -210,6 +210,7 @@ public abstract class AbstractSolrConnector implements SolrConnector {
params.setFacet(false);
params.clearSorts();
params.setFields(CollectionSchema.id.getSolrFieldName());
params.setIncludeScore(false);
// query the server
QueryResponse rsp = getResponseByParams(params);
@ -234,6 +235,7 @@ public abstract class AbstractSolrConnector implements SolrConnector {
params.setFacet(false);
params.clearSorts();
params.setFields(CollectionSchema.id.getSolrFieldName());
params.setIncludeScore(false);
// query the server
QueryResponse rsp = getResponseByParams(params);
@ -262,6 +264,7 @@ public abstract class AbstractSolrConnector implements SolrConnector {
params.setFacetSort(FacetParams.FACET_SORT_COUNT);
params.setFields(fields);
params.clearSorts();
params.setIncludeScore(false);
for (String field: fields) params.addFacetField(field);
// query the server
@ -288,6 +291,7 @@ public abstract class AbstractSolrConnector implements SolrConnector {
query.setRows(1);
query.setStart(0);
if (fields.length > 0) query.setFields(fields);
query.setIncludeScore(false);
// query the server
try {

@ -166,6 +166,19 @@ public class ConcurrentUpdateSolrConnector implements SolrConnector {
}
}
private void removeIdFromDeleteQueue(String id) {
if (this.updateQueue.size() == 0) return;
Iterator<String> i = this.deleteQueue.iterator();
while (i.hasNext()) {
String docID = i.next();
if (docID == null) break;
if (docID.equals(id)) {
i.remove();
break;
}
}
}
private void updateIdCache(String id) {
if (id == null) return;
if (this.idCache.size() >= this.idCacheCapacity || MemoryControl.shortStatus()) this.idCache.clear();
@ -204,7 +217,6 @@ public class ConcurrentUpdateSolrConnector implements SolrConnector {
@Override
public void commit(boolean softCommit) {
this.connector.commit(softCommit);
if (!softCommit) {
long timeout = System.currentTimeMillis() + 1000;
ensureAliveDeletionHandler();
@ -218,6 +230,7 @@ public class ConcurrentUpdateSolrConnector implements SolrConnector {
if (System.currentTimeMillis() > timeout) break;
}
}
this.connector.commit(softCommit);
}
@Override
@ -292,7 +305,9 @@ public class ConcurrentUpdateSolrConnector implements SolrConnector {
@Override
public void add(SolrInputDocument solrdoc) throws IOException, SolrException {
updateIdCache((String) solrdoc.getFieldValue(CollectionSchema.id.getSolrFieldName()));
String id = (String) solrdoc.getFieldValue(CollectionSchema.id.getSolrFieldName());
removeIdFromDeleteQueue(id);
updateIdCache(id);
try {this.updateQueue.put(solrdoc);} catch (InterruptedException e) {}
}

Loading…
Cancel
Save