mirror of https://github.com/apache/lucene.git
Inline decodeNorm() in TermQuery to make searches faster in Java implementations, like GCJ, where simple methods are not inlined.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150530 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e1e3d71cc8
commit
8ca05a3deb
|
@ -102,6 +102,13 @@ public abstract class Similarity {
|
|||
return NORM_TABLE[b & 0xFF];
|
||||
}
|
||||
|
||||
/** Returns a table for decoding normalization bytes.
|
||||
* @see #encodeNorm(float)
|
||||
*/
|
||||
public static float[] getNormDecoder() {
|
||||
return NORM_TABLE;
|
||||
}
|
||||
|
||||
/** Computes the normalization value for a field given the total number of
|
||||
* terms contained in a field. These values, together with field boosts, are
|
||||
* stored in an index and multipled into scores for hits on each field by the
|
||||
|
|
|
@ -62,6 +62,7 @@ final class TermScorer extends Scorer {
|
|||
|
||||
protected boolean score(HitCollector c, int end) throws IOException {
|
||||
Similarity similarity = getSimilarity(); // cache sim in local
|
||||
float[] normDecoder = similarity.getNormDecoder();
|
||||
while (doc < end) { // for docs in window
|
||||
int f = freqs[pointer];
|
||||
float score = // compute tf(f)*weight
|
||||
|
@ -69,7 +70,7 @@ final class TermScorer extends Scorer {
|
|||
? scoreCache[f] // cache hit
|
||||
: similarity.tf(f)*weightValue; // cache miss
|
||||
|
||||
score *= Similarity.decodeNorm(norms[doc]); // normalize for field
|
||||
score *= normDecoder[norms[doc] & 0xFF]; // normalize for field
|
||||
|
||||
c.collect(doc, score); // collect score
|
||||
|
||||
|
|
Loading…
Reference in New Issue