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

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

本文整理了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

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

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

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

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

  1. public Sort toSort(List<? extends OrderSpecifier<?>> orderBys) {
  2. List<SortField> sorts = new ArrayList<SortField>(orderBys.size());
  3. for (OrderSpecifier<?> order : orderBys) {
  4. if (!(order.getTarget() instanceof Path<?>)) {
  5. throw new IllegalArgumentException("argument was not of type Path.");
  6. }
  7. Class<?> type = order.getTarget().getType();
  8. boolean reverse = !order.isAscending();
  9. Path<?> path = getPath(order.getTarget());
  10. if (Number.class.isAssignableFrom(type)) {
  11. sorts.add(new SortField(toField(path), sortFields.get(type), reverse));
  12. } else {
  13. sorts.add(new SortField(toField(path), sortLocale, reverse));
  14. }
  15. }
  16. Sort sort = new Sort();
  17. sort.setSort(sorts.toArray(new SortField[sorts.size()]));
  18. return sort;
  19. }
  20. }

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

  1. public Sort toSort(List<? extends OrderSpecifier<?>> orderBys) {
  2. List<SortField> sorts = new ArrayList<SortField>(orderBys.size());
  3. for (OrderSpecifier<?> order : orderBys) {
  4. if (!(order.getTarget() instanceof Path<?>)) {
  5. throw new IllegalArgumentException("argument was not of type Path.");
  6. }
  7. Class<?> type = order.getTarget().getType();
  8. boolean reverse = !order.isAscending();
  9. Path<?> path = getPath(order.getTarget());
  10. if (Number.class.isAssignableFrom(type)) {
  11. sorts.add(new SortField(toField(path), sortFields.get(type), reverse));
  12. } else {
  13. sorts.add(new SortField(toField(path), SortField.Type.STRING, reverse));
  14. }
  15. }
  16. Sort sort = new Sort();
  17. sort.setSort(sorts.toArray(new SortField[sorts.size()]));
  18. return sort;
  19. }
  20. }

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

  1. public Sort toSort(List<? extends OrderSpecifier<?>> orderBys) {
  2. List<SortField> sorts = new ArrayList<SortField>(orderBys.size());
  3. for (OrderSpecifier<?> order : orderBys) {
  4. if (!(order.getTarget() instanceof Path<?>)) {
  5. throw new IllegalArgumentException(
  6. "argument was not of type Path.");
  7. }
  8. Class<?> type = order.getTarget().getType();
  9. boolean reverse = !order.isAscending();
  10. Path<?> path = getPath(order.getTarget());
  11. if (Number.class.isAssignableFrom(type)) {
  12. sorts.add(new SortedNumericSortField(toField(path), sortFields.get(type),
  13. reverse));
  14. } else {
  15. sorts.add(new SortField(toField(path), SortField.Type.STRING,
  16. reverse));
  17. }
  18. }
  19. Sort sort = new Sort();
  20. sort.setSort(sorts.toArray(new SortField[sorts.size()]));
  21. return sort;
  22. }
  23. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. @Override
  2. public Sort readObject(final ObjectInput input) throws IOException, ClassNotFoundException {
  3. final int count = UnsignedNumeric.readUnsignedInt(input);
  4. SortField[] sortfields = new SortField[count];
  5. for (int i = 0; i < count; i++) {
  6. sortfields[i] = LuceneSortFieldExternalizer.readObjectStatic(input);
  7. }
  8. Sort sort = new Sort();
  9. sort.setSort(sortfields);
  10. return sort;
  11. }

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

  1. @Override
  2. public Sort readObject(final ObjectInput input) throws IOException, ClassNotFoundException {
  3. final int count = UnsignedNumeric.readUnsignedInt(input);
  4. SortField[] sortfields = new SortField[count];
  5. for (int i=0; i<count; i++) {
  6. sortfields[i] = LuceneSortFieldExternalizer.readObjectStatic(input);
  7. }
  8. Sort sort = new Sort();
  9. sort.setSort(sortfields);
  10. return sort;
  11. }

相关文章