public BM25FQuery build() {int size = fieldAndWeights.size() * termsSet.size();if (size > IndexSearcher.getMaxClauseCount()) {throw new IndexSearcher.TooManyClauses();}BytesRef[] terms = termsSet.toArray(new BytesRef[0]);return new BM25FQuery(similarity, new TreeMap<>(fieldAndWeights), terms);}

public virtual StemmerOverrideMap Build(){ByteSequenceOutputs outputs = ByteSequenceOutputs.Singleton;Builder<BytesRef> builder = new Builder<BytesRef>(FST.INPUT_TYPE.BYTE4, outputs);int[] sort = hash.Sort(BytesRef.UTF8SortedAsUnicodeComparer);Int32sRef intsSpare = new Int32sRef();int size = hash.Count;for (int i = 0; i < size; i++){int id = sort[i];BytesRef bytesRef = hash.Get(id, spare);UnicodeUtil.UTF8toUTF32(bytesRef, intsSpare);builder.Add(intsSpare, new BytesRef(outputValues[id]));}return new StemmerOverrideMap(builder.Finish(), ignoreCase);}
