@Override public BytesRef lookupOrd(int ord) { assert ord >= 0 && ord < sortedValues.length; assert sortedValues[ord] >= 0 && sortedValues[ord] < sortedValues.length; hash.get(sortedValues[ord], scratch); return scratch; }
@Override public BytesRef lookupOrd(long ord) { assert ord >= 0 && ord < ordMap.length: "ord=" + ord + " is out of bounds 0 .. " + (ordMap.length-1); hash.get(sortedValues[Math.toIntExact(ord)], scratch); return scratch; } }
@Override public final Query rewrite(final IndexReader reader, final MultiTermQuery query) throws IOException { final B builder = getTopLevelBuilder(); final ParallelArraysTermCollector col = new ParallelArraysTermCollector(); collectTerms(reader, query, col); final int size = col.terms.size(); if (size > 0) { final int sort[] = col.terms.sort(); final float[] boost = col.array.boost; final TermContext[] termStates = col.array.termState; for (int i = 0; i < size; i++) { final int pos = sort[i]; final Term term = new Term(query.getField(), col.terms.get(pos, new BytesRef())); assert reader.docFreq(term) == termStates[pos].docFreq(); addClause(builder, term, termStates[pos].docFreq(), boost[pos], termStates[pos]); } } return build(builder); }
boolean checkOnlyInCompound = dictionary.onlyincompound != -1; if (checkKeepCase || checkNeedAffix || checkOnlyInCompound) { dictionary.flagLookup.get(forms.ints[forms.offset+i], scratch); char wordFlags[] = Dictionary.decodeFlags(scratch);
for(int outputIDX=0;outputIDX<count;outputIDX++) { int wordID = bytesReader.readVInt(); synonyms.words.get(wordID, scratchBytes); scratchChars.copyUTF8Bytes(scratchBytes); int lastStart = 0;
if (forms != null) { for (int i = 0; i < forms.length; i += formStep) { dictionary.flagLookup.get(forms.ints[forms.offset+i], scratch); char wordFlags[] = Dictionary.decodeFlags(scratch); if (Dictionary.hasFlag(wordFlags, flag)) { if (chainedPrefix == false && prefixFlag >= 0 && !Dictionary.hasFlag(wordFlags, (char)prefixFlag)) { dictionary.flagLookup.get(append, scratch); char appendFlags[] = Dictionary.decodeFlags(scratch); if (!hasCrossCheckedFlag((char)prefixFlag, appendFlags, false)) { dictionary.flagLookup.get(append, scratch); char appendFlags[] = Dictionary.decodeFlags(scratch); boolean suffixCircumfix = Dictionary.hasFlag(appendFlags, (char)dictionary.circumfix); dictionary.flagLookup.get(append, scratch); char appendFlags[] = Dictionary.decodeFlags(scratch); circumfix = Dictionary.hasFlag(appendFlags, (char)dictionary.circumfix);
@Override public BytesRef next() throws IOException { if (upto >= sortedTerms.length) return null; upto++; if (sortedTerms[upto] == -1) return null; this.terms.get(sortedTerms[upto], scratch); return scratch; } }
@Override public BytesRef lookupOrd(int ord) { assert ord >= 0 && ord < sortedValues.length; assert sortedValues[ord] >= 0 && sortedValues[ord] < sortedValues.length; hash.get(sortedValues[ord], scratch); return scratch; }
@Override public BytesRef currentValue() { if (groupId == -1) return null; values.get(groupId, scratch); return scratch; }
/** * Returns an {@link StemmerOverrideMap} to be used with the {@link StemmerOverrideFilter} * @return an {@link StemmerOverrideMap} to be used with the {@link StemmerOverrideFilter} * @throws IOException if an {@link IOException} occurs; */ public StemmerOverrideMap build() throws IOException { ByteSequenceOutputs outputs = ByteSequenceOutputs.getSingleton(); org.apache.lucene.util.fst.Builder<BytesRef> builder = new org.apache.lucene.util.fst.Builder<>( FST.INPUT_TYPE.BYTE4, outputs); final int[] sort = hash.sort(); IntsRefBuilder intsSpare = new IntsRefBuilder(); final int size = hash.size(); BytesRef spare = new BytesRef(); for (int i = 0; i < size; i++) { int id = sort[i]; BytesRef bytesRef = hash.get(id, spare); intsSpare.copyUTF8Bytes(bytesRef); builder.add(intsSpare.get(), new BytesRef(outputValues.get(id))); } return new StemmerOverrideMap(builder.finish(), ignoreCase); }
} else { dictionary.flagLookup.get(append, scratch); char appendFlags[] = Dictionary.decodeFlags(scratch); compatible = !Dictionary.hasFlag(appendFlags, (char) dictionary.onlyincompound); dictionary.flagLookup.get(append, scratch); char appendFlags[] = Dictionary.decodeFlags(scratch); assert prevFlag >= 0; } else { dictionary.flagLookup.get(append, scratch); char appendFlags[] = Dictionary.decodeFlags(scratch); compatible = !Dictionary.hasFlag(appendFlags, (char) dictionary.onlyincompound); dictionary.flagLookup.get(append, scratch); char appendFlags[] = Dictionary.decodeFlags(scratch); assert prevFlag >= 0;
@Override public BytesRef lookupOrd(long ord) { assert ord >= 0 && ord < ordMap.length: "ord=" + ord + " is out of bounds 0 .. " + (ordMap.length-1); hash.get(sortedValues[Math.toIntExact(ord)], scratch); return scratch; } }
synonyms.words.get(bytesReader.readVInt(), scratchBytes);
@Override public BytesRef next() { termUpto++; if (termUpto >= info.terms.size()) { return null; } else { info.terms.get(info.sortedTerms[termUpto], br); return br; } }
@Override public BytesRef next() { if (!hasNext()) { throw new NoSuchElementException(); } hash.get(sortedValues[ordUpto], scratch); ordUpto++; return scratch; }
@Override public void seekExact(long ord) { assert ord < info.terms.size(); termUpto = (int) ord; info.terms.get(info.sortedTerms[termUpto], br); }
@Override public BytesRef next() { if (!hasNext()) { throw new NoSuchElementException(); } hash.get(sortedValues[ordUpto], scratch); ordUpto++; return scratch; }
private SortedDocValues getSortedDocValues(String field, DocValuesType docValuesType) { Info info = getInfoForExpectedDocValuesType(field, docValuesType); if (info != null) { BytesRef value = info.binaryProducer.dvBytesValuesSet.get(0, new BytesRef()); return sortedDocValues(value); } else { return null; } }
SeekingTermSetTermsEnum(TermsEnum tenum, BytesRefTermsSet termsSet) { super(tenum); this.terms = termsSet.getBytesRefHash(); this.ords = this.terms.sort(BytesRef.getUTF8SortedAsUnicodeComparator()); lastElement = terms.size() - 1; lastTerm = terms.get(ords[lastElement], new BytesRef()); seekTerm = terms.get(ords[upto], spare); }
@Override public void setNextReader(LeafReaderContext readerContext) throws IOException { this.docValues = DocValues.getSorted(readerContext.reader(), field); this.ordsToGroupIds.clear(); BytesRef scratch = new BytesRef(); for (int i = 0; i < values.size(); i++) { values.get(i, scratch); int ord = this.docValues.lookupTerm(scratch); if (ord >= 0) ordsToGroupIds.put(ord, i); } }