/** * Sets whether to return only term vectors for special selected fields. Returns the term * vectors for all fields if selectedFields == null */ public TermVectorsRequestBuilder setSelectedFields(String... fields) { request.selectedFields(fields); return this; }
private static void handleFieldWildcards(IndexShard indexShard, TermVectorsRequest request) { Set<String> fieldNames = new HashSet<>(); for (String pattern : request.selectedFields()) { fieldNames.addAll(indexShard.mapperService().simpleMatchToFullName(pattern)); } request.selectedFields(fieldNames.toArray(Strings.EMPTY_ARRAY)); }
public static void addFieldStringsFromParameter(TermVectorsRequest termVectorsRequest, String fields) { Set<String> selectedFields = termVectorsRequest.selectedFields(); if (fields != null) { String[] paramFieldStrings = Strings.commaDelimitedListToStringArray(fields); for (String field : paramFieldStrings) { if (selectedFields == null) { selectedFields = new HashSet<>(); } if (!selectedFields.contains(field)) { field = field.replaceAll("\\s", ""); selectedFields.add(field); } } } if (selectedFields != null) { termVectorsRequest.selectedFields(selectedFields.toArray(new String[selectedFields.size()])); } }
public TermVectorsRequest(MultiGetRequest.Item item) { super(item.index()); this.id = item.id(); this.type = item.type(); this.selectedFields(item.storedFields()); this.routing(item.routing()); this.parent(item.parent()); }
private static Fields generateTermVectorsFromDoc(IndexShard indexShard, TermVectorsRequest request) throws IOException { // parse the document, at the moment we do update the mapping, just like percolate ParsedDocument parsedDocument = parseDocument(indexShard, indexShard.shardId().getIndexName(), request.type(), request.doc(), request.xContentType()); // select the right fields and generate term vectors ParseContext.Document doc = parsedDocument.rootDoc(); Set<String> seenFields = new HashSet<>(); Collection<DocumentField> documentFields = new HashSet<>(); for (IndexableField field : doc.getFields()) { MappedFieldType fieldType = indexShard.mapperService().fullName(field.name()); if (!isValidField(fieldType)) { continue; } if (request.selectedFields() != null && !request.selectedFields().contains(field.name())) { continue; } if (seenFields.contains(field.name())) { continue; } else { seenFields.add(field.name()); } String[] values = doc.getValues(field.name()); documentFields.add(new DocumentField(field.name(), Arrays.asList((Object[]) values))); } return generateTermVectors(indexShard, XContentHelper.convertToMap(parsedDocument.source(), true, request.xContentType()).v2(), documentFields, request.offsets(), request.perFieldAnalyzer(), seenFields); }
/** * Sets whether to return only term vectors for special selected fields. Returns the term * vectors for all fields if selectedFields == null */ public TermVectorsRequestBuilder setSelectedFields(String... fields) { request.selectedFields(fields); return this; }
/** * Sets whether to return only term vectors for special selected fields. Returns the term * vectors for all fields if selectedFields == null */ public TermVectorsRequestBuilder setSelectedFields(String... fields) { request.selectedFields(fields); return this; }
/** * Sets whether to return only term vectors for special selected fields. Returns the term * vectors for all fields if selectedFields == null */ public TermVectorsRequestBuilder setSelectedFields(String... fields) { request.selectedFields(fields); return this; }
/** * Convert this to a {@link TermVectorsRequest} for fetching the terms of the document. */ TermVectorsRequest toTermVectorsRequest() { TermVectorsRequest termVectorsRequest = new TermVectorsRequest(index, type, id) .selectedFields(fields) .routing(routing) .version(version) .versionType(versionType) .perFieldAnalyzer(perFieldAnalyzer) .positions(false) // ensures these following parameters are never set .offsets(false) .payloads(false) .fieldStatistics(false) .termStatistics(false); // for artificial docs to make sure that the id has changed in the item too if (doc != null) { termVectorsRequest.doc(doc, true, xContentType); this.id = termVectorsRequest.id(); } return termVectorsRequest; }
termVectorsRequest.selectedFields(fields.toArray(fieldsAsArray));
private static void handleFieldWildcards(IndexShard indexShard, TermVectorsRequest request) { Set<String> fieldNames = new HashSet<>(); for (String pattern : request.selectedFields()) { fieldNames.addAll(indexShard.mapperService().simpleMatchToFullName(pattern)); } request.selectedFields(fieldNames.toArray(Strings.EMPTY_ARRAY)); }
private void handleFieldWildcards(TermVectorsRequest request) { Set<String> fieldNames = new HashSet<>(); for (String pattern : request.selectedFields()) { fieldNames.addAll(indexShard.mapperService().simpleMatchToIndexNames(pattern)); } request.selectedFields(fieldNames.toArray(Strings.EMPTY_ARRAY)); }
private static void handleFieldWildcards(IndexShard indexShard, TermVectorsRequest request) { Set<String> fieldNames = new HashSet<>(); for (String pattern : request.selectedFields()) { fieldNames.addAll(indexShard.mapperService().simpleMatchToIndexNames(pattern)); } request.selectedFields(fieldNames.toArray(Strings.EMPTY_ARRAY)); }
private static void handleFieldWildcards(IndexShard indexShard, TermVectorsRequest request) { Set<String> fieldNames = new HashSet<>(); for (String pattern : request.selectedFields()) { fieldNames.addAll(indexShard.mapperService().simpleMatchToFullName(pattern)); } request.selectedFields(fieldNames.toArray(Strings.EMPTY_ARRAY)); }
if (request.selectedFields() != null) { handleFieldWildcards(indexShard, request); Set<String> selectedFields = request.selectedFields(); termVectorsFilter = new TermVectorsFilter(termVectorsByField, topLevelFields, request.selectedFields(), dfs); termVectorsFilter.setSettings(request.filterSettings()); try { termVectorsResponse.setFields(termVectorsByField, request.selectedFields(), request.getFlags(), topLevelFields, dfs, termVectorsFilter);
public TermVectorsRequest(MultiGetRequest.Item item) { super(item.index()); this.id = item.id(); this.type = item.type(); this.selectedFields(item.fields()); this.routing(item.routing()); }
private AggregatedDfs getAggregatedDfs(Fields termVectorsFields, TermVectorsRequest request) throws IOException { DfsOnlyRequest dfsOnlyRequest = new DfsOnlyRequest(termVectorsFields, new String[]{request.index()}, new String[]{request.type()}, request.selectedFields()); DfsOnlyResponse response = dfsAction.execute(dfsOnlyRequest).actionGet(); return response.getDfs(); } }
public TermVectorsRequest(MultiGetRequest.Item item) { super(item.index()); this.id = item.id(); this.type = item.type(); this.selectedFields(item.storedFields()); this.routing(item.routing()); this.parent(item.parent()); }
public TermVectorsRequest(MultiGetRequest.Item item) { super(item.index()); this.id = item.id(); this.type = item.type(); this.selectedFields(item.storedFields()); this.routing(item.routing()); this.parent(item.parent()); }
public TermVectorsRequest(MultiGetRequest.Item item) { super(item.index()); this.id = item.id(); this.type = item.type(); this.selectedFields(item.storedFields()); this.routing(item.routing()); this.parent(item.parent()); }