Codota Logo
SortField.getComparatorSource
Code IndexAdd Codota to your IDE (free)

How to use
getComparatorSource
method
in
org.apache.lucene.search.SortField

Best Java code snippets using org.apache.lucene.search.SortField.getComparatorSource (Showing top 20 results out of 315)

  • Common ways to obtain SortField
private void myMethod () {
SortField s =
  • Codota IconString field;SortField.Type type;new SortField(field, type, reverse)
  • Codota IconSort sort;sort.getSort()
  • Codota IconIndexSearcher searcher;fields[i].rewrite(searcher)
  • Smart code suggestions by Codota
}
origin: org.elasticsearch/elasticsearch

/**
 * Returns the inner {@link SortField.Type} expected for this sort field.
 */
static SortField.Type extractSortType(SortField sortField) {
  if (sortField.getComparatorSource() instanceof IndexFieldData.XFieldComparatorSource) {
    return ((IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource()).reducedType();
  } else if (sortField instanceof SortedSetSortField) {
    return SortField.Type.STRING;
  } else if (sortField instanceof SortedNumericSortField) {
    return ((SortedNumericSortField) sortField).getNumericType();
  } else if ("LatLonPointSortField".equals(sortField.getClass().getSimpleName())) {
    // for geo distance sorting
    return SortField.Type.DOUBLE;
  } else {
    return sortField.getType();
  }
}
origin: org.elasticsearch/elasticsearch

  out.writeString(sortField.getField());
if (sortField.getComparatorSource() != null) {
  IndexFieldData.XFieldComparatorSource comparatorSource =
      (IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource();
  writeSortType(out, comparatorSource.reducedType());
  writeMissingValue(out, comparatorSource.missingValue(sortField.getReverse()));
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Returns the inner {@link SortField.Type} expected for this sort field.
 */
static SortField.Type extractSortType(SortField sortField) {
  if (sortField.getComparatorSource() instanceof IndexFieldData.XFieldComparatorSource) {
    return ((IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource()).reducedType();
  } else if (sortField instanceof SortedSetSortField) {
    return SortField.Type.STRING;
  } else if (sortField instanceof SortedNumericSortField) {
    return ((SortedNumericSortField) sortField).getNumericType();
  } else if ("LatLonPointSortField".equals(sortField.getClass().getSimpleName())) {
    // for geo distance sorting
    return SortField.Type.DOUBLE;
  } else {
    return sortField.getType();
  }
}
origin: msokolov/lux

private String formatSortCriterion(SortField sortField) {
  StringBuilder buf = new StringBuilder();
  buf.append (sortField.getField());
  if (sortField.getReverse()) {
    buf.append (" descending");
  }
  if (SearchResultIterator.MISSING_LAST.equals(sortField.getComparatorSource())) {
    buf.append (" empty greatest");
  }
  switch (sortField.getType()) {
  case INT: buf.append(" int"); break;
  case LONG: buf.append(" long"); break;
  default: // default is string
  }
  return buf.toString();
}
origin: apache/servicemix-bundles

/**
 * Returns the inner {@link SortField.Type} expected for this sort field.
 */
static SortField.Type extractSortType(SortField sortField) {
  if (sortField.getComparatorSource() instanceof IndexFieldData.XFieldComparatorSource) {
    return ((IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource()).reducedType();
  } else if (sortField instanceof SortedSetSortField) {
    return SortField.Type.STRING;
  } else if (sortField instanceof SortedNumericSortField) {
    return ((SortedNumericSortField) sortField).getNumericType();
  } else if ("LatLonPointSortField".equals(sortField.getClass().getSimpleName())) {
    // for geo distance sorting
    return SortField.Type.DOUBLE;
  } else {
    return sortField.getType();
  }
}
origin: com.strapdata.elasticsearch/elasticsearch

private static Object convertValueFromSortField(Object value, SortField sortField, DocValueFormat format) {
  if (sortField.getComparatorSource() instanceof IndexFieldData.XFieldComparatorSource) {
    IndexFieldData.XFieldComparatorSource cmpSource = (IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource();
    return convertValueFromSortType(sortField.getField(), cmpSource.reducedType(), value, format);
  }
  SortField.Type sortType = extractSortType(sortField);
  return convertValueFromSortType(sortField.getField(), sortType, value, format);
}
origin: metatron-app/metatron-discovery

private SortField getAvailableSortField(String propertyName, org.springframework.data.domain.Sort.Direction direction) {
 if(sortFieldMap.containsKey(propertyName)) {
  SortField availableSortField = sortFieldMap.get(propertyName);
  boolean reverse = direction == org.springframework.data.domain.Sort.Direction.DESC ? true : false;
  if(availableSortField.getType() != null) {
   return new SortField(availableSortField.getField(), availableSortField.getType(), reverse);
  } else {
   return new SortField(availableSortField.getField(), availableSortField.getComparatorSource(), reverse);
  }
 } else {
  return sortFieldMap.get("name");
 }
}
origin: metatron-app/metatron-discovery

 private SortField getAvailableSortField(String propertyName, org.springframework.data.domain.Sort.Direction direction) {

  if (sortFieldMap.containsKey(propertyName)) {
   SortField availableSortField = sortFieldMap.get(propertyName);

   boolean reverse = direction == org.springframework.data.domain.Sort.Direction.DESC ? true : false;
   if (availableSortField.getType() != null) {
    return new SortField(availableSortField.getField(), availableSortField.getType(), reverse);
   } else {
    return new SortField(availableSortField.getField(), availableSortField.getComparatorSource(), reverse);
   }

  } else {
   return sortFieldMap.get("modifiedTime");
  }
 }
}
origin: org.codelibs/elasticsearch-querybuilders

private static Object convertValueFromSortField(Object value, SortField sortField, DocValueFormat format) {
  if (sortField.getComparatorSource() instanceof IndexFieldData.XFieldComparatorSource) {
    IndexFieldData.XFieldComparatorSource cmpSource = (IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource();
    return convertValueFromSortType(sortField.getField(), cmpSource.reducedType(), value, format);
  }
  return convertValueFromSortType(sortField.getField(), sortField.getType(), value, format);
}
origin: metatron-app/metatron-discovery

private SortField getAvailableSortField(String propertyName, org.springframework.data.domain.Sort.Direction direction) {
 if(sortFieldMap.containsKey(propertyName)) {
  SortField availableSortField = sortFieldMap.get(propertyName);
  boolean reverse = direction == org.springframework.data.domain.Sort.Direction.DESC ? true : false;
  if(availableSortField.getType() != null) {
   return new SortField(availableSortField.getField(), availableSortField.getType(), reverse);
  } else {
   return new SortField(availableSortField.getField(), availableSortField.getComparatorSource(), reverse);
  }
 } else {
  return sortFieldMap.get("name");
 }
}
origin: apache/jackrabbit

idx[i] = names.indexOf(orderings[i].getSelectorName());
SortField sf = orderings[i].getSortField();
if (sf.getComparatorSource() != null) {
  FieldComparator c = sf.getComparatorSource().newComparator(sf.getField(), numHits, 0, false);
  assert c instanceof FieldComparatorBase;
  comparators[i] = new ScoreDocComparator((FieldComparatorBase) c);
origin: org.apache.jackrabbit/jackrabbit-core

idx[i] = names.indexOf(orderings[i].getSelectorName());
SortField sf = orderings[i].getSortField();
if (sf.getComparatorSource() != null) {
  FieldComparator c = sf.getComparatorSource().newComparator(sf.getField(), numHits, 0, false);
  assert c instanceof FieldComparatorBase;
  comparators[i] = new ScoreDocComparator((FieldComparatorBase) c);
origin: org.apache.jackrabbit/jackrabbit-core

public Object visit(LowerCaseImpl node, Object data)
    throws Exception {
  SortField sf = (SortField) ((DynamicOperandImpl) node.getOperand()).accept(this, data);
  selectorName[0] = node.getSelectorQName();
  return new SortField(sf.getField(),
      new LowerCaseSortComparator(sf.getComparatorSource()),
      !ordering.isAscending());
}
origin: apache/jackrabbit

public Object visit(LowerCaseImpl node, Object data)
    throws Exception {
  SortField sf = (SortField) ((DynamicOperandImpl) node.getOperand()).accept(this, data);
  selectorName[0] = node.getSelectorQName();
  return new SortField(sf.getField(),
      new LowerCaseSortComparator(sf.getComparatorSource()),
      !ordering.isAscending());
}
origin: org.apache.jackrabbit/jackrabbit-core

public Object visit(UpperCaseImpl node, Object data)
    throws Exception {
  SortField sf = (SortField) ((DynamicOperandImpl) node.getOperand()).accept(this, data);
  selectorName[0] = node.getSelectorQName();
  return new SortField(sf.getField(),
      new UpperCaseSortComparator(sf.getComparatorSource()),
      !ordering.isAscending());
}
origin: apache/jackrabbit

public Object visit(UpperCaseImpl node, Object data)
    throws Exception {
  SortField sf = (SortField) ((DynamicOperandImpl) node.getOperand()).accept(this, data);
  selectorName[0] = node.getSelectorQName();
  return new SortField(sf.getField(),
      new UpperCaseSortComparator(sf.getComparatorSource()),
      !ordering.isAscending());
}
origin: com.strapdata.elasticsearch/elasticsearch

  out.writeString(sortField.getField());
if (sortField.getComparatorSource() != null) {
  IndexFieldData.XFieldComparatorSource comparatorSource = (IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource();
  writeSortType(out, comparatorSource.reducedType());
  writeMissingValue(out, comparatorSource.missingValue(sortField.getReverse()));
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

  out.writeString(sortField.getField());
if (sortField.getComparatorSource() != null) {
  IndexFieldData.XFieldComparatorSource comparatorSource =
      (IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource();
  writeSortType(out, comparatorSource.reducedType());
  writeMissingValue(out, comparatorSource.missingValue(sortField.getReverse()));
origin: org.dspace.dependencies.solr/dspace-solr-core

public ShardFieldSortedHitQueue(SortField[] fields, int size) {
 final int n = fields.length;
 comparators = new Comparator[n];
 this.fields = new SortField[n];
 for (int i = 0; i < n; ++i) {
  // keep track of the named fields
  int type = fields[i].getType();
  if (type!=SortField.SCORE && type!=SortField.DOC) {
   fieldNames.add(fields[i].getField());
  }
  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());
 }
 initialize(size);
}
origin: harbby/presto-connectors

  out.writeString(sortField.getField());
if (sortField.getComparatorSource() != null) {
  IndexFieldData.XFieldComparatorSource comparatorSource = (IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource();
  writeSortType(out, comparatorSource.reducedType());
  writeMissingValue(out, comparatorSource.missingValue(sortField.getReverse()));
org.apache.lucene.searchSortFieldgetComparatorSource

Javadoc

Returns the FieldComparatorSource used for custom sorting

Popular methods of SortField

  • <init>
    Creates a sort, possibly in reverse, by terms in the given field where the type of term value is det
  • getField
    Returns the name of the field. Could return null if the sort is by SCORE or DOC.
  • getReverse
    Returns whether the sort should be reversed.
  • getType
    Returns the type of contents in the field.
  • setMissingValue
    Set the value to use for documents that don't have a value.
  • equals
    Returns true if o is equal to this. If a FieldComparatorSource was provided, it must properly implem
  • getComparator
    Returns the FieldComparator to use for sorting.
  • getMissingValue
    Return the value to use for documents that don't have a value. A value of null indicates that defaul
  • toString
  • hashCode
    Returns a hash code for this SortField instance. If a FieldComparatorSource was provided, it must pr
  • needsScores
    Whether the relevance score is needed to sort documents.
  • getFactory
  • needsScores,
  • getFactory,
  • getLocale,
  • initFieldType,
  • rewrite

Popular in Java

  • Reading from database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JButton (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now