List of usage examples for org.apache.lucene.util IntsRef hashCode
@Override
public int hashCode()
From source file:com.sindicetech.siren.index.codecs.siren10.Siren10PostingsWriter.java
License:Open Source License
@Override public void addPosition(final int position, final BytesRef payload, final int startOffset, final int endOffset) throws IOException { assert indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; // we always receive node ids in the payload assert payload != null; // decode payload sirenPayload.decode(payload);/*from w w w .j a v a 2s .c o m*/ final IntsRef node = sirenPayload.getNode(); // check if we received the same node // TODO: we pay the cost of decoding the node before testing the equality // we could instead directly compute the node hash based on the byte array final int nodeHash = node.hashCode(); if (lastNodeHash != nodeHash) { // if different node // add term freq for previous node if not first payload. if (lastNodeHash != Long.MAX_VALUE) { this.addTermFreqInNode(); } // add new node this.addNode(node); } lastNodeHash = nodeHash; // add position this.addPosition(sirenPayload.getPosition()); }