TermsWriter(FieldInfo fieldInfo) { this.fieldInfo = fieldInfo; noOutputs = NoOutputs.getSingleton(); // This Builder is just used transiently to fragment // terms into "good" blocks; we don't save the // resulting FST: blockBuilder = new Builder<Object>( FST.INPUT_TYPE.BYTE1, 0, 0, true, true, Integer.MAX_VALUE, noOutputs, new FindBlocks(), false, PackedInts.COMPACT, true, 15); postingsWriter.setField(fieldInfo); }
@Override public void finishTerm(BytesRef text, TermStats stats) throws IOException { assert stats.docFreq > 0; // if (DEBUG) System.out.println("BTTW.finishTerm term=" + fieldInfo.name + ":" + // toString(text) + " seg=" + segment + " df=" + stats.docFreq); blockBuilder.add(Util.toIntsRef(text, scratchIntsRef), noOutputs.getNoOutput()); pending.add(new PendingTerm(BytesRef.deepCopyOf(text), stats)); postingsWriter.finishTerm(stats); numTerms++; }
@Override public synchronized boolean load(InputStream input) throws IOException { try { this.higherWeightsCompletion = new FSTCompletion( new FST<Object>(new InputStreamDataInput(input), NoOutputs.getSingleton())); this.normalCompletion = new FSTCompletion(higherWeightsCompletion.getFST(), false, exactMatchFirst); } finally { IOUtils.close(input); } return true; }