mirror of https://github.com/apache/lucene.git
LUCENE-1830: hashCode + equals for BoostNearQuery and PayloadFunction
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@806591 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ac89d0acad
commit
9dad6f3246
|
@ -86,7 +86,7 @@ public class BoostingNearQuery extends SpanNearQuery implements PayloadQuery {
|
||||||
|
|
||||||
public class BoostingSpanScorer extends SpanScorer {
|
public class BoostingSpanScorer extends SpanScorer {
|
||||||
Spans spans;
|
Spans spans;
|
||||||
Spans[] subSpans = null;
|
|
||||||
protected float payloadScore;
|
protected float payloadScore;
|
||||||
private int payloadsSeen;
|
private int payloadsSeen;
|
||||||
Similarity similarity = getSimilarity();
|
Similarity similarity = getSimilarity();
|
||||||
|
@ -161,6 +161,37 @@ public class BoostingNearQuery extends SpanNearQuery implements PayloadQuery {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = prime * result + ((fieldName == null) ? 0 : fieldName.hashCode());
|
||||||
|
result = prime * result + ((function == null) ? 0 : function.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (!super.equals(obj))
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
BoostingNearQuery other = (BoostingNearQuery) obj;
|
||||||
|
if (fieldName == null) {
|
||||||
|
if (other.fieldName != null)
|
||||||
|
return false;
|
||||||
|
} else if (!fieldName.equals(other.fieldName))
|
||||||
|
return false;
|
||||||
|
if (function == null) {
|
||||||
|
if (other.function != null)
|
||||||
|
return false;
|
||||||
|
} else if (!function.equals(other.function))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@ package org.apache.lucene.search.payloads;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.lucene.index.Term;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,9 +31,6 @@ import java.io.Serializable;
|
||||||
**/
|
**/
|
||||||
public abstract class PayloadFunction implements Serializable {
|
public abstract class PayloadFunction implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the score up to this point for this doc and field
|
* Calculate the score up to this point for this doc and field
|
||||||
* @param docId The current doc
|
* @param docId The current doc
|
||||||
|
@ -60,5 +55,9 @@ public abstract class PayloadFunction implements Serializable {
|
||||||
* @return The final score for the payloads
|
* @return The final score for the payloads
|
||||||
*/
|
*/
|
||||||
public abstract float docScore(int docId, String field, int numPayloadsSeen, float payloadScore);
|
public abstract float docScore(int docId, String field, int numPayloadsSeen, float payloadScore);
|
||||||
|
|
||||||
|
public abstract int hashCode();
|
||||||
|
|
||||||
|
public abstract boolean equals(Object o);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue