org.apache.lucene.search.Sort.setSort()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中org.apache.lucene.search.Sort.setSort()方法的一些代码示例,展示了Sort.setSort()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Sort.setSort()方法的具体详情如下:
包路径:org.apache.lucene.search.Sort
类名称:Sort
方法名:setSort

Sort.setSort介绍

[英]Sets the sort to the terms in field then by index order (document number).
[中]将排序设置为field中的术语,然后按索引顺序(文档编号)排序。

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

/** Sets the sort to the given criteria in succession: the
 *  first SortField is checked first, but if it produces a
 *  tie, then the second SortField is used to break the tie,
 *  etc.  Finally, if there is still a tie after all SortFields
 *  are checked, the internal Lucene docid is used to break it. */
public Sort(SortField... fields) {
 setSort(fields);
}

代码示例来源:origin: org.apache.lucene/lucene-core

/** Sorts by the criteria in the given SortField. */
public Sort(SortField field) {
 setSort(field);
}

代码示例来源:origin: querydsl/querydsl

public Sort toSort(List<? extends OrderSpecifier<?>> orderBys) {
    List<SortField> sorts = new ArrayList<SortField>(orderBys.size());
    for (OrderSpecifier<?> order : orderBys) {
      if (!(order.getTarget() instanceof Path<?>)) {
        throw new IllegalArgumentException("argument was not of type Path.");
      }
      Class<?> type = order.getTarget().getType();
      boolean reverse = !order.isAscending();
      Path<?> path = getPath(order.getTarget());
      if (Number.class.isAssignableFrom(type)) {
        sorts.add(new SortField(toField(path), sortFields.get(type), reverse));
      } else {
        sorts.add(new SortField(toField(path), sortLocale, reverse));
      }
    }
    Sort sort = new Sort();
    sort.setSort(sorts.toArray(new SortField[sorts.size()]));
    return sort;
  }
}

代码示例来源:origin: querydsl/querydsl

public Sort toSort(List<? extends OrderSpecifier<?>> orderBys) {
    List<SortField> sorts = new ArrayList<SortField>(orderBys.size());
    for (OrderSpecifier<?> order : orderBys) {
      if (!(order.getTarget() instanceof Path<?>)) {
        throw new IllegalArgumentException("argument was not of type Path.");
      }
      Class<?> type = order.getTarget().getType();
      boolean reverse = !order.isAscending();
      Path<?> path = getPath(order.getTarget());
      if (Number.class.isAssignableFrom(type)) {
        sorts.add(new SortField(toField(path), sortFields.get(type), reverse));
      } else {
        sorts.add(new SortField(toField(path), SortField.Type.STRING, reverse));
      }
    }
    Sort sort = new Sort();
    sort.setSort(sorts.toArray(new SortField[sorts.size()]));
    return sort;
  }
}

代码示例来源:origin: querydsl/querydsl

public Sort toSort(List<? extends OrderSpecifier<?>> orderBys) {
    List<SortField> sorts = new ArrayList<SortField>(orderBys.size());
    for (OrderSpecifier<?> order : orderBys) {
      if (!(order.getTarget() instanceof Path<?>)) {
        throw new IllegalArgumentException(
            "argument was not of type Path.");
      }
      Class<?> type = order.getTarget().getType();
      boolean reverse = !order.isAscending();
      Path<?> path = getPath(order.getTarget());
      if (Number.class.isAssignableFrom(type)) {
        sorts.add(new SortedNumericSortField(toField(path), sortFields.get(type),
            reverse));
      } else {
        sorts.add(new SortField(toField(path), SortField.Type.STRING,
            reverse));
      }
    }
    Sort sort = new Sort();
    sort.setSort(sorts.toArray(new SortField[sorts.size()]));
    return sort;
  }
}

代码示例来源:origin: harbby/presto-connectors

/** Sets the sort to the given criteria in succession: the
 *  first SortField is checked first, but if it produces a
 *  tie, then the second SortField is used to break the tie,
 *  etc.  Finally, if there is still a tie after all SortFields
 *  are checked, the internal Lucene docid is used to break it. */
public Sort(SortField... fields) {
 setSort(fields);
}

代码示例来源:origin: lucene/lucene

/** Sorts by the terms in <code>field</code> then by index order (document
 * number). The type of value in <code>field</code> is determined
 * automatically.
 * @see SortField#AUTO
 */
public Sort (String field) {
  setSort (field, false);
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/**
 * Sets the sort to the terms in <code>field</code> then by index order
 * (document number).
 */
public final void setSort(String field) {
 setSort(field, false);
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/**
 * Sorts by the terms in <code>field</code> then by index order (document
 * number). The type of value in <code>field</code> is determined
 * automatically.
 * 
 * @see SortField#AUTO
 */
public Sort(String field) {
 setSort(field, false);
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/**
 * Sorts in succession by the terms in each field. The type of value in
 * <code>field</code> is determined automatically.
 * 
 * @see SortField#AUTO
 */
public Sort(String[] fields) {
 setSort(fields);
}

代码示例来源:origin: lucene/lucene

/** Sorts in succession by the terms in each field.
 * The type of value in <code>field</code> is determined
 * automatically.
 * @see SortField#AUTO
 */
public Sort (String[] fields) {
  setSort (fields);
}

代码示例来源:origin: lucene/lucene

/** Sets the sort to the terms in <code>field</code> then by index order
 * (document number). */
public final void setSort (String field) {
  setSort (field, false);
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/**
 * Sorts possibly in reverse by the terms in <code>field</code> then by
 * index order (document number). The type of value in <code>field</code> is
 * determined automatically.
 * 
 * @see SortField#AUTO
 */
public Sort(String field, boolean reverse) {
 setSort(field, reverse);
}

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

/**
 * Sorts in succession by the terms in each field. The type of value in
 * <code>field</code> is determined automatically.
 * 
 * @see SortField#AUTO
 */
public Sort(String[] fields) {
 setSort(fields);
}

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

/**
 * Sets the sort to the terms in <code>field</code> then by index order
 * (document number).
 */
public final void setSort(String field) {
 setSort(field, false);
}

代码示例来源:origin: lucene/lucene

/** Sorts in succession by the criteria in each SortField. */
public Sort (SortField[] fields) {
  setSort (fields);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/** Sorts by the criteria in the given SortField. */
public Sort(SortField field) {
 setSort(field);
}

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

/** Sorts in succession by the criteria in each SortField. */
public Sort(SortField[] fields) {
 setSort(fields);
}

代码示例来源:origin: org.infinispan/infinispan-query

@Override
public Sort readObject(final ObjectInput input) throws IOException, ClassNotFoundException {
 final int count = UnsignedNumeric.readUnsignedInt(input);
 SortField[] sortfields = new SortField[count];
 for (int i = 0; i < count; i++) {
   sortfields[i] = LuceneSortFieldExternalizer.readObjectStatic(input);
 }
 Sort sort = new Sort();
 sort.setSort(sortfields);
 return sort;
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
public Sort readObject(final ObjectInput input) throws IOException, ClassNotFoundException {
 final int count = UnsignedNumeric.readUnsignedInt(input);
 SortField[] sortfields = new SortField[count];
 for (int i=0; i<count; i++) {
   sortfields[i] = LuceneSortFieldExternalizer.readObjectStatic(input);
 }
 Sort sort = new Sort();
 sort.setSort(sortfields);
 return sort;
}

相关文章