Created
August 27, 2017 18:49
-
-
Save paul58914080/b1e31544b85f25a8abaf7b3971eba918 to your computer and use it in GitHub Desktop.
Fix for ff4j elasticstore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Search queryReadAllFeatures(Integer totalCount) { | |
return new Search.Builder(new SearchSourceBuilder().size(totalCount).toString()).addIndex(connection.getIndexName()) | |
.addType(ElasticConstants.TYPE_FEATURE).build(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public Map<String, Feature> readAll() { | |
SearchResult resultTotal = getConnection().search(getBuilder().queryReadAllFeatures(), true); | |
Map<String, Feature> mapOfFeatures = new HashMap<String, Feature>(); | |
if (null != resultTotal && resultTotal.isSucceeded()) { | |
Integer total = resultTotal.getTotal(); | |
SearchResult result = getConnection().search(getBuilder().queryReadAllFeatures(total), true); | |
if (null != result && result.isSucceeded()) { | |
for (Hit<Feature, Void> feature : result.getHits(Feature.class)) { | |
mapOfFeatures.put(feature.source.getUid(), feature.source); | |
} | |
} | |
} | |
return mapOfFeatures; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment