Package org.apache.lucene.search

Examples of org.apache.lucene.search.SortField


            // TODO: このへんの定数なんとかするべき。いろんなところに散らばっていて使いにくい。

            Sort sort;
            if ("score".equals(sortOrder)) {
                sort = new Sort(SortField.FIELD_SCORE, new SortField("BEGIN-TIME", SortField.STRING));
            } else if ("createdAt".equals(sortOrder)) {
                sort = new Sort(new SortField("CREATED-AT", SortField.STRING, true));
            } else if ("deadline".equals(sortOrder)) {
                sort = new Sort(new SortField("DEADLINE-TIME", SortField.STRING));
            } else if ("deadline-r".equals(sortOrder)) {
                sort = new Sort(new SortField("DEADLINE-TIME", SortField.STRING, true));
            } else if ("beginDate".equals(sortOrder)) {
                sort = new Sort(new SortField("BEGIN-TIME", SortField.STRING));
            } else if ("beginDate-r".equals(sortOrder)) {
                sort = new Sort(new SortField("BEGIN-TIME", SortField.STRING, true));
            } else {
                // 決まってない場合は、score 順にする。
                sort = new Sort(SortField.FIELD_SCORE, new SortField("BEGIN-TIME", SortField.STRING));
            }

            return indexSearcher.search(query, filter, maxDocument, sort);
        } catch (IOException e) {
            throw new EventSearchServiceException(e);
View Full Code Here


  /////////////////////////////////////////////////////////////
  @Override
  public SortField getSortField(SchemaField field, boolean reverse) {
    field.checkSortability();
    return new SortField(field.name, SortField.DOUBLE, reverse);
  }
View Full Code Here

  /////////////////////////////////////////////////////////////
  @Override
  public SortField getSortField(SchemaField field, boolean reverse) {
    field.checkSortability();
    return new SortField(field.name, SortField.BYTE, reverse);
  }
View Full Code Here

  /////////////////////////////////////////////////////////////

  @Override
  public SortField getSortField(SchemaField field,boolean reverse) {
    field.checkSortability();
    return new SortField(field.name,SortField.LONG, reverse);
  }
View Full Code Here

  /////////////////////////////////////////////////////////////

  @Override
  public SortField getSortField(SchemaField field, boolean reverse) {
    field.checkSortability();
    return new SortField(field.name, SortField.SHORT, reverse);
  }
View Full Code Here

      String fieldname = fields[i].getField();
      comparators[i] = getCachedComparator(fieldname, fields[i]
          .getType(), fields[i].getLocale(), fields[i].getComparatorSource());

     if (fields[i].getType() == SortField.STRING) {
        this.fields[i] = new SortField(fieldname, fields[i].getLocale(),
            fields[i].getReverse());
      } else {
        this.fields[i] = new SortField(fieldname, fields[i].getType(),
            fields[i].getReverse());
      }

      //System.out.println("%%%%%%%%%%%%%%%%%% got "+fields[i].getType() +"   for "+ fieldname +"  fields[i].getReverse(): "+fields[i].getReverse());
    }
View Full Code Here

    if (this.sfields.length != other.sfields.length) return false;
    if (!this.query.equals(other.query)) return false;
    if (!isEqual(this.filters, other.filters)) return false;

    for (int i=0; i<sfields.length; i++) {
      SortField sf1 = this.sfields[i];
      SortField sf2 = other.sfields[i];
      if (!sf1.equals(sf2)) return false;
    }

    return true;
  }
View Full Code Here

  }

  @Override
  public SortField getSortField(SchemaField field,boolean reverse) {
    field.checkSortability();
    return new SortField(field.name,SortField.INT, reverse);
  }
View Full Code Here

  }

  @Override
  public SortField getSortField(SchemaField field,boolean reverse) {
    field.checkSortability();
    return new SortField(field.name,SortField.FLOAT, reverse);
  }
View Full Code Here

    final SortField[] sortFields = groupSort.getSort();
    comparators = new FieldComparator[sortFields.length];
    compIDXEnd = comparators.length - 1;
    reversed = new int[sortFields.length];
    for (int i = 0; i < sortFields.length; i++) {
      final SortField sortField = sortFields[i];
      comparators[i] = sortField.getComparator(topNGroups, i);
      reversed[i] = sortField.getReverse() ? -1 : 1;
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.SortField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.