congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
SortField.getComparatorSource
Code IndexAdd Tabnine 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)

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

  • Running tasks concurrently on multiple threads
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now