Example #1
0
  /**
   * Return a term frequency vector for the specified document and field. The vector returned
   * contains term numbers and frequencies for all terms in the specified field of this document, if
   * the field had storeTermVector flag set. If the flag was not set, the method returns null.
   */
  public TermFreqVector getTermFreqVector(int docNumber, String field) throws IOException {
    // Check if this field is invalid or has no stored term vector
    FieldInfo fi = fieldInfos.fieldInfo(field);
    if (fi == null || !fi.storeTermVector) return null;

    return termVectorsReader.get(docNumber, field);
  }
Example #2
0
  protected final void doClose() throws IOException {
    fieldsReader.close();
    tis.close();

    if (freqStream != null) freqStream.close();
    if (proxStream != null) proxStream.close();

    closeNorms();
    if (termVectorsReader != null) termVectorsReader.close();

    if (cfsReader != null) cfsReader.close();
  }
Example #3
0
  /**
   * Return an array of term frequency vectors for the specified document. The array contains a
   * vector for each vectorized field in the document. Each vector vector contains term numbers and
   * frequencies for all terms in a given vectorized field. If no such fields existed, the method
   * returns null.
   */
  public TermFreqVector[] getTermFreqVectors(int docNumber) throws IOException {
    if (termVectorsReader == null) return null;

    return termVectorsReader.get(docNumber);
  }