@Override public void copyTo(AttributeImpl target) { TermFrequencyAttribute t = (TermFrequencyAttribute) target; t.setTermFrequency(termFrequency); }
private int getTermFreq() { int freq = termFreqAtt.getTermFrequency(); if (freq != 1) { if (hasProx) { throw new IllegalStateException("field \"" + fieldInfo.name + "\": cannot index positions while using custom TermFrequencyAttribute"); } } return freq; }
@Override public boolean incrementToken() { if (used) { return false; } clearAttributes(); termAttribute.append(value); freqAttribute.setTermFrequency(freq); used = true; return true; }
private int getTermFreq() { int freq = termFreqAtt.getTermFrequency(); if (freq != 1) { if (doVectorPositions) { throw new IllegalArgumentException("field \"" + fieldInfo.name + "\": cannot index term vector positions while using custom TermFrequencyAttribute"); } if (doVectorOffsets) { throw new IllegalArgumentException("field \"" + fieldInfo.name + "\": cannot index term vector offsets while using custom TermFrequencyAttribute"); } } return freq; }
@Override public void copyTo(AttributeImpl target) { if (target instanceof PackedTokenAttributeImpl) { final PackedTokenAttributeImpl to = (PackedTokenAttributeImpl) target; to.copyBuffer(buffer(), 0, length()); to.positionIncrement = positionIncrement; to.positionLength = positionLength; to.startOffset = startOffset; to.endOffset = endOffset; to.type = type; to.termFrequency = termFrequency; } else { super.copyTo(target); ((OffsetAttribute) target).setOffset(startOffset, endOffset); ((PositionIncrementAttribute) target).setPositionIncrement(positionIncrement); ((PositionLengthAttribute) target).setPositionLength(positionLength); ((TypeAttribute) target).setType(type); ((TermFrequencyAttribute) target).setTermFrequency(termFrequency); } }
if (termFreqAtt.getTermFrequency() != 1) { throw new IllegalStateException("field \"" + fieldInfo.name + "\": must index term freq while using custom TermFrequencyAttribute");
@Override public boolean incrementToken() throws IOException { if (input.incrementToken()) { final char[] buffer = termAtt.buffer(); final int length = termAtt.length(); for (int i = 0; i < length; i++) { if (buffer[i] == delimiter) { termAtt.setLength(i); // simply set a new length i++; tfAtt.setTermFrequency(ArrayUtil.parseInt(buffer, i, length - i)); return true; } } return true; } return false; } }
invertState.length = Math.addExact(invertState.length, invertState.termFreqAttribute.getTermFrequency()); } catch (ArithmeticException ae) { throw new IllegalArgumentException("too many tokens for field \"" + field.name() + "\"");
@Override public void copyTo(AttributeImpl target) { TermFrequencyAttribute t = (TermFrequencyAttribute) target; t.setTermFrequency(termFrequency); }
private int getTermFreq() { int freq = termFreqAtt.getTermFrequency(); if (freq != 1) { if (hasProx) { throw new IllegalStateException("field \"" + fieldInfo.name + "\": cannot index positions while using custom TermFrequencyAttribute"); } } return freq; }
@Override public boolean incrementToken() { if (used) { return false; } clearAttributes(); termAttribute.append(value); freqAttribute.setTermFrequency(freq); used = true; return true; }
private int getTermFreq() { int freq = termFreqAtt.getTermFrequency(); if (freq != 1) { if (doVectorPositions) { throw new IllegalArgumentException("field \"" + fieldInfo.name + "\": cannot index term vector positions while using custom TermFrequencyAttribute"); } if (doVectorOffsets) { throw new IllegalArgumentException("field \"" + fieldInfo.name + "\": cannot index term vector offsets while using custom TermFrequencyAttribute"); } } return freq; }
@Override public void copyTo(AttributeImpl target) { if (target instanceof PackedTokenAttributeImpl) { final PackedTokenAttributeImpl to = (PackedTokenAttributeImpl) target; to.copyBuffer(buffer(), 0, length()); to.positionIncrement = positionIncrement; to.positionLength = positionLength; to.startOffset = startOffset; to.endOffset = endOffset; to.type = type; to.termFrequency = termFrequency; } else { super.copyTo(target); ((OffsetAttribute) target).setOffset(startOffset, endOffset); ((PositionIncrementAttribute) target).setPositionIncrement(positionIncrement); ((PositionLengthAttribute) target).setPositionLength(positionLength); ((TypeAttribute) target).setType(type); ((TermFrequencyAttribute) target).setTermFrequency(termFrequency); } }
if (termFreqAtt.getTermFrequency() != 1) { throw new IllegalStateException("field \"" + fieldInfo.name + "\": must index term freq while using custom TermFrequencyAttribute");
invertState.length = Math.addExact(invertState.length, invertState.termFreqAttribute.getTermFrequency()); } catch (ArithmeticException ae) { throw new IllegalArgumentException("too many tokens for field \"" + field.name() + "\"");