Skip to content

Commit

Permalink
Reduce the number of callouts to 15 in docs
Browse files Browse the repository at this point in the history
relates to #33447
  • Loading branch information
mayya-sharipova committed Oct 24, 2018
1 parent 6fe0e62 commit d7afd7c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1576,27 +1576,27 @@ public void testTermVectors() throws Exception {

// 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>
}
}
}
Expand Down
33 changes: 16 additions & 17 deletions docs/java-rest/high-level/document/term-vectors.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d7afd7c

Please sign in to comment.