use of io.zulia.doc.ResultDocBuilder in project zuliasearch by zuliaio.
the class StatTest method indexRecord.
private void indexRecord(int id, String title, String pathFacet, String normalFacet, int authorCount, List<Double> rating) throws Exception {
String uniqueId = "" + id;
Document mongoDocument = new Document();
mongoDocument.put("id", uniqueId);
mongoDocument.put("title", title);
mongoDocument.put("pathFacet", pathFacet);
mongoDocument.put("normalFacet", normalFacet);
mongoDocument.put("authorCount", authorCount);
mongoDocument.put("rating", rating);
Store s = new Store(uniqueId, STAT_TEST_INDEX);
ResultDocBuilder resultDocumentBuilder = ResultDocBuilder.newBuilder().setDocument(mongoDocument);
s.setResultDocument(resultDocumentBuilder);
zuliaWorkPool.store(s);
}
use of io.zulia.doc.ResultDocBuilder in project zuliasearch by zuliaio.
the class HierarchicalFacetTest method indexRecord.
private void indexRecord(int id, String path, int i) throws Exception {
boolean half = (i % 2 == 0);
boolean tenth = (i % 10 == 0);
String uniqueId = "mySpecialId-" + id;
Document mongoDocument = new Document();
mongoDocument.put("path", path);
mongoDocument.put("path2", path);
mongoDocument.put("normalFacet", path);
mongoDocument.put("id", id);
if (tenth) {
// 1/10 of input
Date d = Date.from(LocalDate.of(2014, Month.OCTOBER, 4).atStartOfDay(ZoneId.of("UTC")).toInstant());
mongoDocument.put("date", d);
} else if (half) {
// 2/5 of input
Date d = Date.from(LocalDate.of(2013, Month.SEPTEMBER, 4).atStartOfDay(ZoneId.of("UTC")).toInstant());
mongoDocument.put("date", d);
mongoDocument.put("normalFacetList", Arrays.asList("value1", "something"));
} else {
// 1/2 of input
Date d = Date.from(LocalDate.of(2012, 8, 4).atStartOfDay(ZoneId.of("UTC")).toInstant());
mongoDocument.put("date", d);
mongoDocument.put("normalFacetList", Arrays.asList("value2", "something2"));
}
Store s = new Store(uniqueId, FACET_TEST_INDEX);
ResultDocBuilder resultDocumentBuilder = ResultDocBuilder.newBuilder().setDocument(mongoDocument);
s.setResultDocument(resultDocumentBuilder);
zuliaWorkPool.store(s);
}
use of io.zulia.doc.ResultDocBuilder in project zuliasearch by zuliaio.
the class Mapper method toResultDocumentBuilder.
public ResultDocBuilder toResultDocumentBuilder(T object) throws Exception {
String uniqueId = uniqueIdField.build(object);
Document document = toDocument(object);
ResultDocBuilder resultDocumentBuilder = new ResultDocBuilder();
resultDocumentBuilder.setDocument(document).setUniqueId(uniqueId);
return resultDocumentBuilder;
}
Aggregations