mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
avoid cloning
This commit is contained in:
parent
cc39667399
commit
5a02d650ee
|
@ -21,7 +21,6 @@
|
|||
package net.yacy.cora.federate.solr.connector;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -235,7 +234,7 @@ public abstract class AbstractSolrConnector implements SolrConnector {
|
|||
* @return a collection of a subset of the ids which exist in the index
|
||||
* @throws IOException
|
||||
*/
|
||||
public Set<String> existsByIds(Collection<String> ids) throws IOException {
|
||||
public Set<String> existsByIds(Set<String> ids) throws IOException {
|
||||
if (ids == null || ids.size() == 0) return new HashSet<String>();
|
||||
// construct raw query
|
||||
final SolrQuery params = new SolrQuery();
|
||||
|
|
|
@ -326,10 +326,10 @@ public class ConcurrentUpdateSolrConnector implements SolrConnector {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> existsByIds(Collection<String> ids) throws IOException {
|
||||
public Set<String> existsByIds(Set<String> ids) throws IOException {
|
||||
HashSet<String> e = new HashSet<String>();
|
||||
if (ids == null || ids.size() == 0) return e;
|
||||
Collection<String> idsC = new HashSet<String>();
|
||||
Set<String> idsC = new HashSet<String>();
|
||||
for (String id: ids) {
|
||||
if (this.idCache.has(ASCII.getBytes(id))) {cacheSuccessSign(); e.add(id); continue;}
|
||||
if (existIdFromDeleteQueue(id)) {cacheSuccessSign(); continue;}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
package net.yacy.cora.federate.solr.connector;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
@ -224,9 +223,9 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> existsByIds(Collection<String> ids) {
|
||||
public Set<String> existsByIds(Set<String> ids) {
|
||||
if (ids == null || ids.size() == 0) return new HashSet<String>();
|
||||
if (ids.size() == 1 && ids instanceof Set) return existsById(ids.iterator().next()) ? (Set<String>) ids : new HashSet<String>();
|
||||
if (ids.size() == 1) return existsById(ids.iterator().next()) ? ids : new HashSet<String>();
|
||||
StringBuilder sb = new StringBuilder(); // construct something like "({!raw f=id}Ij7B63g-gSHA) OR ({!raw f=id}PBcGI3g-gSHA)"
|
||||
for (String id: ids) {
|
||||
sb.append("({!raw f=").append(CollectionSchema.id.getSolrFieldName()).append('}').append(id).append(") OR ");
|
||||
|
|
|
@ -347,7 +347,7 @@ public class MirrorSolrConnector extends AbstractSolrConnector implements SolrCo
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> existsByIds(Collection<String> ids) throws IOException {
|
||||
public Set<String> existsByIds(Set<String> ids) throws IOException {
|
||||
if (this.solr0 != null && this.solr1 == null) return this.solr0.existsByIds(ids);
|
||||
if (this.solr0 == null && this.solr1 != null) return this.solr1.existsByIds(ids);
|
||||
Set<String> s = new HashSet<String>();
|
||||
|
|
|
@ -106,7 +106,7 @@ public interface SolrConnector extends Iterable<String> /* Iterable of document
|
|||
* @return a collection of a subset of the ids which exist in the index
|
||||
* @throws IOException
|
||||
*/
|
||||
public Set<String> existsByIds(Collection<String> ids) throws IOException;
|
||||
public Set<String> existsByIds(Set<String> ids) throws IOException;
|
||||
|
||||
/**
|
||||
* check if a given document exists in solr
|
||||
|
|
|
@ -620,7 +620,7 @@ public final class Fulltext {
|
|||
public Set<String> exists(Collection<String> ids) {
|
||||
HashSet<String> e = new HashSet<String>();
|
||||
if (ids == null || ids.size() == 0) return e;
|
||||
Collection<String> idsC = new HashSet<String>();
|
||||
Set<String> idsC = new HashSet<String>();
|
||||
idsC.addAll(ids);
|
||||
if (this.urlIndexFile != null) {
|
||||
Iterator<String> idsi = idsC.iterator();
|
||||
|
|
Loading…
Reference in New Issue
Block a user