congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
SortField.getLocale
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: org.apache.lucene/com.springsource.org.apache.lucene

/** Returns an array of collators, possibly <code>null</code>.  The collators
 * correspond to any SortFields which were given a specific locale.
 * @param fields Array of sort fields.
 * @return Array, possibly <code>null</code>.
 */
private Collator[] hasCollators (final SortField[] fields) {
  if (fields == null) return null;
  Collator[] ret = new Collator[fields.length];
  for (int i=0; i<fields.length; ++i) {
    Locale locale = fields[i].getLocale();
    if (locale != null)
      ret[i] = Collator.getInstance (locale);
  }
  return ret;
}
origin: org.apache.lucene/lucene-core-jfrog

/** Returns an array of collators, possibly <code>null</code>.  The collators
 * correspond to any SortFields which were given a specific locale.
 * @param fields Array of sort fields.
 * @return Array, possibly <code>null</code>.
 */
private Collator[] hasCollators (final SortField[] fields) {
  if (fields == null) return null;
  Collator[] ret = new Collator[fields.length];
  for (int i=0; i<fields.length; ++i) {
    Locale locale = fields[i].getLocale();
    if (locale != null)
      ret[i] = Collator.getInstance (locale);
  }
  return ret;
}
origin: lucene/lucene

/** Returns an array of collators, possibly <code>null</code>.  The collators
 * correspond to any SortFields which were given a specific locale.
 * @param fields Array of sort fields.
 * @return Array, possibly <code>null</code>.
 */
private Collator[] hasCollators (final SortField[] fields) {
  if (fields == null) return null;
  Collator[] ret = new Collator[fields.length];
  for (int i=0; i<fields.length; ++i) {
    Locale locale = fields[i].getLocale();
    if (locale != null)
      ret[i] = Collator.getInstance (locale);
  }
  return ret;
}
origin: lucene/lucene

if (s2 == null) c = -1;      // could be null if there are
else if (s1 == null) c = 1;  // no terms in the given field
else if (fields[i].getLocale() == null) {
  c = s2.compareTo(s1);
} else {
else if (fields[i].getLocale() == null) {
  c = s1.compareTo(s2);
} else {
origin: org.apache.lucene/lucene-core-jfrog

else if (fields[i].getLocale() == null) {
  c = s1.compareTo(s2);
} else {
origin: org.apache.lucene/com.springsource.org.apache.lucene

else if (fields[i].getLocale() == null) {
  c = s1.compareTo(s2);
} else {
origin: org.dspace.dependencies.solr/dspace-solr-core

public QueryResultKey(Query query, List<Query> filters, Sort sort, int nc_flags) {
 this.query = query;
 this.sort = sort;
 this.filters = filters;
 this.nc_flags = nc_flags;
 int h = query.hashCode();
 if (filters != null) h ^= filters.hashCode();
 sfields = (this.sort !=null) ? this.sort.getSort() : defaultSort;
 for (SortField sf : sfields) {
  // mix the bits so that sortFields are position dependent
  // so that a,b won't hash to the same value as b,a
  h ^= (h << 8) | (h >>> 25);   // reversible hash
  if (sf.getField() != null) h += sf.getField().hashCode();
  h += sf.getType();
  if (sf.getReverse()) h=~h;
  if (sf.getLocale()!=null) h+=sf.getLocale().hashCode();
  if (sf.getFactory()!=null) h+=sf.getFactory().hashCode();
 }
 hc = h;
}
origin: org.apache.lucene/com.springsource.org.apache.lucene

/**
 * Creates a hit queue sorted by the given list of fields.
 * @param reader  Index to use.
 * @param fields Fieldable names, in priority order (highest priority first).  Cannot be <code>null</code> or empty.
 * @param size  The number of hits to retain.  Must be greater than zero.
 * @throws IOException
 */
public FieldSortedHitQueue (IndexReader reader, SortField[] fields, int size)
throws IOException {
 final int n = fields.length;
 comparators = new ScoreDocComparator[n];
 this.fields = new SortField[n];
 for (int i=0; i<n; ++i) {
  String fieldname = fields[i].getField();
  comparators[i] = getCachedComparator (reader, fieldname, fields[i].getType(), fields[i].getLocale(), fields[i].getFactory());
  
  if (comparators[i].sortType() == SortField.STRING) {
    this.fields[i] = new SortField (fieldname, fields[i].getLocale(), fields[i].getReverse());
  } else {
    this.fields[i] = new SortField (fieldname, comparators[i].sortType(), fields[i].getReverse());
  }
 }
 initialize (size);
}
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: org.apache.lucene/lucene-core-jfrog

/**
 * Creates a hit queue sorted by the given list of fields.
 * @param reader  Index to use.
 * @param fields Fieldable names, in priority order (highest priority first).  Cannot be <code>null</code> or empty.
 * @param size  The number of hits to retain.  Must be greater than zero.
 * @throws IOException
 */
public FieldSortedHitQueue (IndexReader reader, SortField[] fields, int size)
throws IOException {
 final int n = fields.length;
 comparators = new ScoreDocComparator[n];
 this.fields = new SortField[n];
 for (int i=0; i<n; ++i) {
  String fieldname = fields[i].getField();
  comparators[i] = getCachedComparator (reader, fieldname, fields[i].getType(), fields[i].getLocale(), fields[i].getFactory());
  
  if (comparators[i].sortType() == SortField.STRING) {
    this.fields[i] = new SortField (fieldname, fields[i].getLocale(), fields[i].getReverse());
  } else {
    this.fields[i] = new SortField (fieldname, comparators[i].sortType(), fields[i].getReverse());
  }
 }
 initialize (size);
}
origin: org.dspace.dependencies.solr/dspace-solr-core

public boolean equals(Object o) {
 if (o==this) return true;
 if (!(o instanceof QueryResultKey)) return false;
 QueryResultKey other = (QueryResultKey)o;
 // fast check of the whole hash code... most hash tables will only use
 // some of the bits, so if this is a hash collision, it's still likely
 // that the full cached hash code will be different.
 if (this.hc != other.hc) return false;
 // check for the thing most likely to be different (and the fastest things)
 // first.
 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.getType() != sf2.getType()) return false;
  if (sf1.getReverse() != sf2.getReverse()) return false;
  if (!isEqual(sf1.getField(),sf2.getField())) return false;
  if (!isEqual(sf1.getLocale(), sf2.getLocale())) return false;
  if (!isEqual(sf1.getFactory(), sf2.getFactory())) return false;
  // NOTE: the factory must be identical!!! use singletons!
 }
 return true;
}
origin: lucene/lucene

/**
 * Creates a hit queue sorted by the given list of fields.
 * @param reader  Index to use.
 * @param fields Field names, in priority order (highest priority first).  Cannot be <code>null</code> or empty.
 * @param size  The number of hits to retain.  Must be greater than zero.
 * @throws IOException
 */
FieldSortedHitQueue (IndexReader reader, SortField[] fields, int size)
throws IOException {
 final int n = fields.length;
 comparators = new ScoreDocComparator[n];
 this.fields = new SortField[n];
 for (int i=0; i<n; ++i) {
  String fieldname = fields[i].getField();
  comparators[i] = getCachedComparator (reader, fieldname, fields[i].getType(), fields[i].getLocale(), fields[i].getFactory());
  this.fields[i] = new SortField (fieldname, comparators[i].sortType(), fields[i].getReverse());
 }
 initialize (size);
}
org.apache.lucene.searchSortFieldgetLocale

Javadoc

Returns the Locale by which term values are interpreted. May return null if no Locale was specified.

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.
  • getComparatorSource
    Returns the FieldComparatorSource used for custom 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.
  • hashCode,
  • needsScores,
  • getFactory,
  • initFieldType,
  • rewrite

Popular in Java

  • Creating JSON documents from java classes using gson
  • setContentView (Activity)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • JFrame (javax.swing)
  • 21 Best IntelliJ Plugins
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