@Override public NumericDocValues getNorms(FieldInfo field) throws IOException { return reader.getNormValues(field.name); }
@Override public NumericDocValues getNormValues(final String field) throws IOException { return isMeta(field) ? in.getNormValues(field) : null; }
@Override public NumericDocValues getNormValues(String field) throws IOException { ensureOpen(); LeafReader reader = fieldToReader.get(field); NumericDocValues values = reader == null ? null : reader.getNormValues(field); return values; }
@Override public NumericDocValues getNormValues(String field) throws IOException { ensureOpen(); return in.getNormValues(field); }
@Override public int nextDoc() throws IOException { while (true) { if (currentValues == null) { if (nextLeaf == leaves.size()) { docID = NO_MORE_DOCS; return docID; } currentLeaf = leaves.get(nextLeaf); currentValues = currentLeaf.reader().getNormValues(field); nextLeaf++; continue; } int newDocID = currentValues.nextDoc(); if (newDocID == NO_MORE_DOCS) { currentValues = null; continue; } else { docID = currentLeaf.docBase + newDocID; return docID; } } }
@Override public boolean advanceExact(int targetDocID) throws IOException { if (targetDocID < docID) { throw new IllegalArgumentException("can only advance beyond current document: on docID=" + docID + " but targetDocID=" + targetDocID); } int readerIndex = ReaderUtil.subIndex(targetDocID, leaves); if (readerIndex >= nextLeaf) { if (readerIndex == leaves.size()) { throw new IllegalArgumentException("Out of range: " + targetDocID); } currentLeaf = leaves.get(readerIndex); currentValues = currentLeaf.reader().getNormValues(field); nextLeaf = readerIndex+1; } docID = targetDocID; if (currentValues == null) { return false; } return currentValues.advanceExact(targetDocID - currentLeaf.docBase); }
@Override public int advance(int targetDocID) throws IOException { if (targetDocID <= docID) { throw new IllegalArgumentException("can only advance beyond current document: on docID=" + docID + " but targetDocID=" + targetDocID); } int readerIndex = ReaderUtil.subIndex(targetDocID, leaves); if (readerIndex >= nextLeaf) { if (readerIndex == leaves.size()) { currentValues = null; docID = NO_MORE_DOCS; return docID; } currentLeaf = leaves.get(readerIndex); currentValues = currentLeaf.reader().getNormValues(field); if (currentValues == null) { return nextDoc(); } nextLeaf = readerIndex+1; } int newDocID = currentValues.advance(targetDocID - currentLeaf.docBase); if (newDocID == NO_MORE_DOCS) { currentValues = null; return nextDoc(); } else { docID = currentLeaf.docBase + newDocID; return docID; } }
@Override public final SimScorer simScorer(SimWeight stats, LeafReaderContext context) throws IOException { BM25Stats bm25stats = (BM25Stats) stats; return new BM25DocScorer(bm25stats, context.reader().getMetaData().getCreatedVersionMajor(), context.reader().getNormValues(bm25stats.field)); }
@Override public final SimScorer simScorer(SimWeight stats, LeafReaderContext context) throws IOException { int indexCreatedVersionMajor = context.reader().getMetaData().getCreatedVersionMajor(); if (stats instanceof MultiSimilarity.MultiStats) { // a multi term query (e.g. phrase). return the summation, // scoring almost as if it were boolean query SimWeight subStats[] = ((MultiSimilarity.MultiStats) stats).subStats; SimScorer subScorers[] = new SimScorer[subStats.length]; for (int i = 0; i < subScorers.length; i++) { BasicStats basicstats = (BasicStats) subStats[i]; subScorers[i] = new BasicSimScorer(basicstats, indexCreatedVersionMajor, context.reader().getNormValues(basicstats.field)); } return new MultiSimilarity.MultiSimScorer(subScorers); } else { BasicStats basicstats = (BasicStats) stats; return new BasicSimScorer(basicstats, indexCreatedVersionMajor, context.reader().getNormValues(basicstats.field)); } }
@Override public final SimScorer simScorer(SimWeight stats, LeafReaderContext context) throws IOException { IDFStats idfstats = (IDFStats) stats; final float[] normTable; if (context.reader().getMetaData().getCreatedVersionMajor() >= 7) { // the norms only encode the length, we need a translation table that depends on how lengthNorm is implemented normTable = idfstats.normTable; } else { // the norm is directly encoded in the index normTable = OLD_NORM_TABLE; } return new TFIDFSimScorer(idfstats, context.reader().getNormValues(idfstats.field), normTable); }
@Override public Scorer scorer(LeafReaderContext context) throws IOException { FieldInfos fieldInfos = context.reader().getFieldInfos(); FieldInfo fieldInfo = fieldInfos.fieldInfo(field); if (fieldInfo == null || fieldInfo.hasNorms() == false) { return null; } LeafReader reader = context.reader(); DocIdSetIterator iterator = reader.getNormValues(field); return new ConstantScoreScorer(this, score(), iterator); }
return null; } else if (size == 1) { return leaves.get(0).reader().getNormValues(field);
@Override public NumericDocValues getNormValues(String field) throws IOException { final NumericDocValues oldNorms = in.getNormValues(field); if (oldNorms == null) return null; CachedNumericDVs norms; synchronized (cachedNorms) { norms = cachedNorms.get(field); if (norms == null) { FixedBitSet docsWithField = new FixedBitSet(maxDoc()); long[] values = new long[maxDoc()]; while (true) { int docID = oldNorms.nextDoc(); if (docID == NO_MORE_DOCS) { break; } int newDocID = docMap.oldToNew(docID); docsWithField.set(newDocID); values[newDocID] = oldNorms.longValue(); } norms = new CachedNumericDVs(values, docsWithField); cachedNorms.put(field, norms); } } return new SortingNumericDocValues(norms); }
reader.getNormValues(info.name); normsCount++;
final Term term = weight.terms[i]; final SimilarityScript script = scriptFactory.newInstance(); final NumericDocValues norms = context.reader().getNormValues(weight.fieldName); final Doc doc = new Doc(norms); final double scoreWeight = computeWeight(weight.query, weight.field, term);
@Override public NumericDocValues getNormValues(String field) throws IOException { ensureOpen(); LeafReader reader = fieldToReader.get(field); NumericDocValues values = reader == null ? null : reader.getNormValues(field); return values; }
@Override public NumericDocValues getNormValues(String field) throws IOException { ensureOpen(); LeafReader reader = fieldToReader.get(field); NumericDocValues values = reader == null ? null : reader.getNormValues(field); return values; }
@Override public final SimScorer simScorer(SimWeight stats, LeafReaderContext context) throws IOException { BM25Stats bm25stats = (BM25Stats) stats; return new BM25LDocScorer(bm25stats, context.reader().getNormValues(bm25stats.field)); }
@Override public SimScorer simScorer(SimWeight stats, LeafReaderContext context) throws IOException { // final was removed (KB) BM25Stats bm25stats = (BM25Stats) stats; return new BM25DocScorer(bm25stats, context.reader().getNormValues(bm25stats.field)); }
@Override public final SimScorer simScorer(SimWeight stats, LeafReaderContext context) throws IOException { Stats axStats = (Stats) stats; return new AxDocScorer(axStats, context.reader().getMetaData().getCreatedVersionMajor(), context.reader().getNormValues(axStats.field)); }