parent
6fe0e62b7a
commit
d7afd7c123
|
@ -1576,27 +1576,27 @@ public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
|
||||
// tag::term-vectors-term-vectors
|
||||
if (response.getTermVectorsList() != null) {
|
||||
List<TermVectorsResponse.TermVector> tvList = response.getTermVectorsList(); // <1>
|
||||
List<TermVectorsResponse.TermVector> tvList = response.getTermVectorsList();
|
||||
for (TermVectorsResponse.TermVector tv : tvList) {
|
||||
String fieldname = tv.getFieldName(); // <2>
|
||||
int docCount = tv.getFieldStatistics().getDocCount(); // <3>
|
||||
long sumTotalTermFreq = tv.getFieldStatistics().getSumTotalTermFreq(); // <4>
|
||||
long sumDocFreq = tv.getFieldStatistics().getSumDocFreq(); // <5>
|
||||
String fieldname = tv.getFieldName(); // <1>
|
||||
int docCount = tv.getFieldStatistics().getDocCount(); // <2>
|
||||
long sumTotalTermFreq = tv.getFieldStatistics().getSumTotalTermFreq(); // <3>
|
||||
long sumDocFreq = tv.getFieldStatistics().getSumDocFreq(); // <4>
|
||||
if (tv.getTerms() != null) {
|
||||
List<TermVectorsResponse.TermVector.Term> terms = tv.getTerms(); // <6>
|
||||
List<TermVectorsResponse.TermVector.Term> terms = tv.getTerms(); // <5>
|
||||
for (TermVectorsResponse.TermVector.Term term : terms) {
|
||||
String termStr = term.getTerm(); // <7>
|
||||
int termFreq = term.getTermFreq(); // <8>
|
||||
int docFreq = term.getDocFreq(); // <9>
|
||||
long totalTermFreq = term.getTotalTermFreq(); // <10>
|
||||
float score = term.getScore(); // <11>
|
||||
String termStr = term.getTerm(); // <6>
|
||||
int termFreq = term.getTermFreq(); // <7>
|
||||
int docFreq = term.getDocFreq(); // <8>
|
||||
long totalTermFreq = term.getTotalTermFreq(); // <9>
|
||||
float score = term.getScore(); // <10>
|
||||
if (term.getTokens() != null) {
|
||||
List<TermVectorsResponse.TermVector.Token> tokens = term.getTokens(); // <12>
|
||||
List<TermVectorsResponse.TermVector.Token> tokens = term.getTokens(); // <11>
|
||||
for (TermVectorsResponse.TermVector.Token token : tokens) {
|
||||
int position = token.getPosition(); // <13>
|
||||
int startOffset = token.getStartOffset(); // <14>
|
||||
int endOffset = token.getEndOffset(); // <15>
|
||||
String payload = token.getPayload(); // <16>
|
||||
int position = token.getPosition(); // <12>
|
||||
int startOffset = token.getStartOffset(); // <13>
|
||||
int endOffset = token.getEndOffset(); // <14>
|
||||
String payload = token.getPayload(); // <15>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,25 +78,24 @@ include-tagged::{doc-tests-file}[{api}-response]
|
|||
|
||||
===== Inspecting Term Vectors
|
||||
If `TermVectorsResponse` contains non-null list of term vectors,
|
||||
more information about them can be obtained using following:
|
||||
more information about each term vector can be obtained using the following:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests-file}[{api}-term-vectors]
|
||||
--------------------------------------------------
|
||||
<1> The list of `TermVector` for the document
|
||||
<2> The name of the current field
|
||||
<3> Fields statistics for the current field - document count
|
||||
<4> Fields statistics for the current field - sum of total term frequencies
|
||||
<5> Fields statistics for the current field - sum of document frequencies
|
||||
<6> Terms for the current field
|
||||
<7> The name of the term
|
||||
<8> Term frequency of the term
|
||||
<9> Document frequency of the term
|
||||
<10> Total term frequency of the term
|
||||
<11> Score of the term
|
||||
<12> Tokens of the term
|
||||
<13> Position of the token
|
||||
<14> Start offset of the token
|
||||
<15> End offset of the token
|
||||
<16> Payload of the token
|
||||
<1> The name of the current field
|
||||
<2> Fields statistics for the current field - document count
|
||||
<3> Fields statistics for the current field - sum of total term frequencies
|
||||
<4> Fields statistics for the current field - sum of document frequencies
|
||||
<5> Terms for the current field
|
||||
<6> The name of the term
|
||||
<7> Term frequency of the term
|
||||
<8> Document frequency of the term
|
||||
<9> Total term frequency of the term
|
||||
<10> Score of the term
|
||||
<11> Tokens of the term
|
||||
<12> Position of the token
|
||||
<13> Start offset of the token
|
||||
<14> End offset of the token
|
||||
<15> Payload of the token
|
||||
|
|
Loading…
Reference in New Issue