@Override public Slice getTargetSlice(String id, SolrInputDocument sdoc, String route, SolrParams params, DocCollection collection) { int hash; if (route != null) { hash = sliceHash(route, sdoc, params, collection); } else { if (id == null) id = getId(sdoc, params); hash = sliceHash(id, sdoc, params, collection); } return hashToSlice(hash, collection); }
@Override public boolean isTargetSlice(String id, SolrInputDocument sdoc, SolrParams params, String shardId, DocCollection collection) { if (id == null) id = getId(sdoc, params); int hash = sliceHash(id, sdoc, params, collection); Range range = collection.getSlice(shardId).getRange(); return range != null && range.includes(hash); }
@Override public Collection<Slice> getSearchSlicesSingle(String shardKey, SolrParams params, DocCollection collection) { if (shardKey == null) { // search across whole collection // TODO: this may need modification in the future when shard splitting could cause an overlap return collection.getActiveSlices(); } // use the shardKey as an id for plain hashing Slice slice = getTargetSlice(shardKey, null, null, params, collection); return slice == null ? Collections.<Slice>emptyList() : Collections.singletonList(slice); } }
@Override public boolean isTargetSlice(String id, SolrInputDocument sdoc, SolrParams params, String shardId, DocCollection collection) { if (id == null) id = getId(sdoc, params); int hash = sliceHash(id, sdoc, params, collection); Range range = collection.getSlice(shardId).getRange(); return range != null && range.includes(hash); }
@Override public Collection<Slice> getSearchSlicesSingle(String shardKey, SolrParams params, DocCollection collection) { if (shardKey == null) { // search across whole collection // TODO: this may need modification in the future when shard splitting could cause an overlap return collection.getActiveSlices(); } // use the shardKey as an id for plain hashing Slice slice = getTargetSlice(shardKey, null, null, params, collection); return slice == null ? Collections.<Slice>emptyList() : Collections.singletonList(slice); } }
@Override public Slice getTargetSlice(String id, SolrInputDocument sdoc, String route, SolrParams params, DocCollection collection) { int hash; if (route != null) { hash = sliceHash(route, sdoc, params, collection); } else { if (id == null) id = getId(sdoc, params); hash = sliceHash(id, sdoc, params, collection); } return hashToSlice(hash, collection); }