Example usage for org.apache.lucene.analysis.tokenattributes TermFrequencyAttribute getTermFrequency

List of usage examples for org.apache.lucene.analysis.tokenattributes TermFrequencyAttribute getTermFrequency

Introduction

In this page you can find the example usage for org.apache.lucene.analysis.tokenattributes TermFrequencyAttribute getTermFrequency.

Prototype

public int getTermFrequency();

Source Link

Document

Returns the custom term frequencey.

Usage

From source file:org.elasticsearch.index.mapper.FeatureFieldMapperTests.java

License:Apache License

static int getFrequency(TokenStream tk) throws IOException {
    TermFrequencyAttribute freqAttribute = tk.addAttribute(TermFrequencyAttribute.class);
    tk.reset();//from   ww  w  .  ja va2s .co  m
    assertTrue(tk.incrementToken());
    int freq = freqAttribute.getTermFrequency();
    assertFalse(tk.incrementToken());
    return freq;
}