/** * Constructs a new score sort. */ public static ScoreSortBuilder scoreSort() { return new ScoreSortBuilder(); }
/** * Build a ScoreSortBuilder default to descending sort order. */ public ScoreSortBuilder() { // order defaults to desc when sorting on the _score order(SortOrder.DESC); }
}else{ nativeSearchQueryBuilder.withSort(SortBuilders.scoreSort().order(SortOrder.DESC)); nativeSearchQueryBuilder.withSort(SortBuilders.scoreSort().order(SortOrder.DESC)); nativeSearchQueryBuilder.withSort(SortBuilders.scoreSort().order(SortOrder.DESC)); NativeSearchQuery searchQuery = nativeSearchQueryBuilder.build(); LOGGER.info("DSL:{}", searchQuery.getQuery().toString());
private static TopHitsAggregationBuilder createSubAggregation(SuggestionQuery query) { return AggregationBuilders.topHits(DOCS_AGGREGATION_NAME) .highlighter(new HighlightBuilder() .encoder("html") .preTags("<mark>") .postTags("</mark>") .field(createHighlighterField())) .from(query.getSkip()) .size(query.getLimit()) .sort(new ScoreSortBuilder()) .sort(new FieldSortBuilder(ComponentIndexDefinition.FIELD_NAME)) .fetchSource(false); }
/** * Read from a stream. */ public ScoreSortBuilder(StreamInput in) throws IOException { order(SortOrder.readFromStream(in)); }
private static SortBuilder<?> fieldOrScoreSort(String fieldName) { if (fieldName.equals(ScoreSortBuilder.NAME)) { return new ScoreSortBuilder(); } else { return new FieldSortBuilder(fieldName); } }
/** * Adds a sort against the given field name and the sort ordering. * * @param name * The name of the field * @param order * The sort ordering */ public TopHitsAggregationBuilder sort(String name, SortOrder order) { if (name == null) { throw new IllegalArgumentException("sort [name] must not be null: [" + name + "]"); } if (order == null) { throw new IllegalArgumentException("sort [order] must not be null: [" + name + "]"); } if (name.equals(ScoreSortBuilder.NAME)) { sort(SortBuilders.scoreSort().order(order)); } sort(SortBuilders.fieldSort(name).order(order)); return this; }
/** * Constructs a new score sort. */ public static ScoreSortBuilder scoreSort() { return new ScoreSortBuilder(); }
/** * Adds a sort against the given field name and the sort ordering. * * @param name * The name of the field * @param order * The sort ordering */ public SearchSourceBuilder sort(String name, SortOrder order) { if (name.equals(ScoreSortBuilder.NAME)) { return sort(SortBuilders.scoreSort().order(order)); } return sort(SortBuilders.fieldSort(name).order(order)); }
/** * Constructs a new score sort. */ public static ScoreSortBuilder scoreSort() { return new ScoreSortBuilder(); }
/** * Build a ScoreSortBuilder default to descending sort order. */ public ScoreSortBuilder() { // order defaults to desc when sorting on the _score order(SortOrder.DESC); }
/** * Constructs a new score sort. */ public static ScoreSortBuilder scoreSort() { return new ScoreSortBuilder(); }
/** * Build a ScoreSortBuilder default to descending sort order. */ public ScoreSortBuilder() { // order defaults to desc when sorting on the _score order(SortOrder.DESC); }
/** * Constructs a new score sort. */ public static ScoreSortBuilder scoreSort() { return new ScoreSortBuilder(); }
/** * Build a ScoreSortBuilder default to descending sort order. */ public ScoreSortBuilder() { // order defaults to desc when sorting on the _score order(SortOrder.DESC); }
private static SortBuilder<?> fieldOrScoreSort(String fieldName) { if (fieldName.equals(ScoreSortBuilder.NAME)) { return new ScoreSortBuilder(); } else { return new FieldSortBuilder(fieldName); } }
/** * Read from a stream. */ public ScoreSortBuilder(StreamInput in) throws IOException { order(SortOrder.readFromStream(in)); }
private static SortBuilder<?> fieldOrScoreSort(String fieldName) { if (fieldName.equals(ScoreSortBuilder.NAME)) { return new ScoreSortBuilder(); } else { return new FieldSortBuilder(fieldName); } }
/** * Read from a stream. */ public ScoreSortBuilder(StreamInput in) throws IOException { order(SortOrder.readFromStream(in)); }
private static SortBuilder<?> fieldOrScoreSort(String fieldName) { if (fieldName.equals(ScoreSortBuilder.NAME)) { return new ScoreSortBuilder(); } else { return new FieldSortBuilder(fieldName); } }