/** Expert: Resets the normalization factor for the named field of the named * document. * * @see #norms(String) * @see Similarity#decodeNorm(byte) */ public void setNorm(int doc, String field, float value) throws IOException { setNorm(doc, field, Similarity.encodeNorm(value)); }
if (! reader.isDeleted(d)) { if (sim == null) reader.setNorm(d, fieldName, Similarity.encodeNorm(1.0f)); else { invertState.setLength(termCounts[d]);
/** Expert: Resets the normalization factor for the named field of the named * document. * * @see #norms(String) * @see Similarity#decodeNorm(byte) * * @throws StaleReaderException if the index has changed * since this reader was opened * @throws CorruptIndexException if the index is corrupt * @throws LockObtainFailedException if another writer * has this index open (<code>write.lock</code> could not * be obtained) * @throws IOException if there is a low-level IO error */ public void setNorm(int doc, String field, float value) throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException { ensureOpen(); setNorm(doc, field, Similarity.encodeNorm(value)); }
/** Expert: Resets the normalization factor for the named field of the named * document. * * @see #norms(String) * @see Similarity#decodeNorm(byte) * * @throws StaleReaderException if the index has changed * since this reader was opened * @throws CorruptIndexException if the index is corrupt * @throws LockObtainFailedException if another writer * has this index open (<code>write.lock</code> could not * be obtained) * @throws IOException if there is a low-level IO error */ public void setNorm(int doc, String field, float value) throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException { ensureOpen(); setNorm(doc, field, Similarity.encodeNorm(value)); }
void finish() { assert docIDs.length == norms.length; if (fieldInfo.isIndexed && !fieldInfo.omitNorms) { if (docIDs.length <= upto) { assert docIDs.length == upto; docIDs = ArrayUtil.grow(docIDs, 1+upto); norms = ArrayUtil.grow(norms, 1+upto); } final float norm = fieldState.boost * docState.similarity.lengthNorm(fieldInfo.name, fieldState.length); norms[upto] = Similarity.encodeNorm(norm); docIDs[upto] = docState.docID; upto++; } } }
void finish() { assert docIDs.length == norms.length; if (fieldInfo.isIndexed && !fieldInfo.omitNorms) { if (docIDs.length <= upto) { assert docIDs.length == upto; docIDs = ArrayUtil.grow(docIDs, 1+upto); norms = ArrayUtil.grow(norms, 1+upto); } final float norm = fieldState.boost * docState.similarity.lengthNorm(fieldInfo.name, fieldState.length); norms[upto] = Similarity.encodeNorm(norm); docIDs[upto] = docState.docID; upto++; } } }
private final void writeNorms(Document doc, String segment) throws IOException { for(int n = 0; n < fieldInfos.size(); n++){ FieldInfo fi = fieldInfos.fieldInfo(n); if(fi.isIndexed){ float norm = fieldBoosts[n] * similarity.lengthNorm(fi.name, fieldLengths[n]); OutputStream norms = directory.createFile(segment + ".f" + n); try { norms.writeByte(Similarity.encodeNorm(norm)); } finally { norms.close(); } } } } }