You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2015/02/06 17:16:27 UTC
svn commit: r1657880 -
/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/package.html
Author: romseygeek
Date: Fri Feb 6 16:16:26 2015
New Revision: 1657880
URL: http://svn.apache.org/r1657880
Log:
LUCENE-4524: Fix javadocs
Modified:
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/package.html
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/package.html?rev=1657880&r1=1657879&r2=1657880&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/package.html (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/package.html Fri Feb 6 16:16:26 2015
@@ -107,12 +107,12 @@ if (found) {
</p>
<a name="documents"></a>
<h4>
- Documents
+ Documents
</h4>
<p>
-{@link org.apache.lucene.index.DocsEnum} is an extension of
-{@link org.apache.lucene.search.DocIdSetIterator}that iterates over the list of
-documents for a term, along with the term frequency within that document.
+ {@link org.apache.lucene.index.PostingsEnum} is an extension of
+ {@link org.apache.lucene.search.DocIdSetIterator}that iterates over the list of
+ documents for a term, along with the term frequency within that document.
<pre class="prettyprint">
int docid;
while ((docid = docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
@@ -123,23 +123,24 @@ while ((docid = docsEnum.nextDoc()) != D
</p>
<a name="positions"></a>
<h4>
- Positions
+ Positions
</h4>
<p>
-{@link org.apache.lucene.index.DocsAndPositionsEnum} is an extension of
-{@link org.apache.lucene.index.DocsEnum} that additionally allows iteration
-of the positions a term occurred within the document, and any additional
-per-position information (offsets and payload)
+ PostingsEnum also allows iteration
+ of the positions a term occurred within the document, and any additional
+ per-position information (offsets and payload). The information available
+ is controlled by flags passed to TermsEnum#postings
<pre class="prettyprint">
int docid;
-while ((docid = docsAndPositionsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+PostingsEnum postings = termsEnum.postings(null, null, PostingsEnum.FLAG_PAYLOADS | PostingsEnum.FLAG_OFFSETS);
+while ((docid = postings.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
System.out.println(docid);
- int freq = docsAndPositionsEnum.freq();
+ int freq = postings.freq();
for (int i = 0; i < freq; i++) {
- System.out.println(docsAndPositionsEnum.nextPosition());
- System.out.println(docsAndPositionsEnum.startOffset());
- System.out.println(docsAndPositionsEnum.endOffset());
- System.out.println(docsAndPositionsEnum.getPayload());
+ System.out.println(postings.nextPosition());
+ System.out.println(postings.startOffset());
+ System.out.println(postings.endOffset());
+ System.out.println(postings.getPayload());
}
}
</pre>