/** * Rewrites the SortFields in this Sort, returning a new Sort if any of the fields * changes during their rewriting. * * @param searcher IndexSearcher to use in the rewriting * @return {@code this} if the Sort/Fields have not changed, or a new Sort if there * is a change * @throws IOException Can be thrown by the rewriting * @lucene.experimental */ public Sort rewrite(IndexSearcher searcher) throws IOException { boolean changed = false; SortField[] rewrittenSortFields = new SortField[fields.length]; for (int i = 0; i < fields.length; i++) { rewrittenSortFields[i] = fields[i].rewrite(searcher); if (fields[i] != rewrittenSortFields[i]) { changed = true; } } return (changed) ? new Sort(rewrittenSortFields) : this; }
/** * Rewrites the SortFields in this Sort, returning a new Sort if any of the fields * changes during their rewriting. * * @param searcher IndexSearcher to use in the rewriting * @return {@code this} if the Sort/Fields have not changed, or a new Sort if there * is a change * @throws IOException Can be thrown by the rewriting * @lucene.experimental */ public Sort rewrite(IndexSearcher searcher) throws IOException { boolean changed = false; SortField[] rewrittenSortFields = new SortField[fields.length]; for (int i = 0; i < fields.length; i++) { rewrittenSortFields[i] = fields[i].rewrite(searcher); if (fields[i] != rewrittenSortFields[i]) { changed = true; } } return (changed) ? new Sort(rewrittenSortFields) : this; }
/** * Rewrites the SortFields in this Sort, returning a new Sort if any of the fields * changes during their rewriting. * * @param searcher IndexSearcher to use in the rewriting * @return {@code this} if the Sort/Fields have not changed, or a new Sort if there * is a change * @throws IOException Can be thrown by the rewriting * @lucene.experimental */ public Sort rewrite(IndexSearcher searcher) throws IOException { boolean changed = false; SortField[] rewrittenSortFields = new SortField[fields.length]; for (int i = 0; i < fields.length; i++) { rewrittenSortFields[i] = fields[i].rewrite(searcher); if (fields[i] != rewrittenSortFields[i]) { changed = true; } } return (changed) ? new Sort(rewrittenSortFields) : this; }
/** * Rewrites the SortFields in this Sort, returning a new Sort if any of the fields * changes during their rewriting. * * @param searcher IndexSearcher to use in the rewriting * @return {@code this} if the Sort/Fields have not changed, or a new Sort if there * is a change * @throws IOException Can be thrown by the rewriting * @lucene.experimental */ public Sort rewrite(IndexSearcher searcher) throws IOException { boolean changed = false; SortField[] rewrittenSortFields = new SortField[fields.length]; for (int i = 0; i < fields.length; i++) { rewrittenSortFields[i] = fields[i].rewrite(searcher); if (fields[i] != rewrittenSortFields[i]) { changed = true; } } return (changed) ? new Sort(rewrittenSortFields) : this; }