Example usage for org.apache.lucene.search SortField equals

List of usage examples for org.apache.lucene.search SortField equals

Introduction

In this page you can find the example usage for org.apache.lucene.search SortField equals.

Prototype

@Override
public boolean equals(Object o) 

Source Link

Document

Returns true if o is equal to this.

Usage

From source file:lux.compiler.XPathQuery.java

License:Mozilla Public License

private SortField[] combineSortFields(XPathQuery precursor) {
    if (sortFields != null) {
        if (precursor.sortFields != null) {
            ArrayList<SortField> combined = new ArrayList<SortField>(Arrays.asList(sortFields));
            SortField prevSort = combined.get(combined.size() - 1);
            for (SortField sortField : precursor.sortFields) {
                if (!sortField.equals(prevSort)) {
                    combined.add(sortField);
                }//from   w  ww . j a va 2s.  co m
            }
            return combined.toArray(new SortField[combined.size()]);
        } else {
            return sortFields;
        }
    } else if (precursor.sortFields != null) {
        return precursor.sortFields;
    } else {
        return null;
    }
}

From source file:org.apache.solr.search.QueryResultKey.java

License:Apache License

@Override
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.//from w  ww  . j a  v a 2s.c  o  m
    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;
}