Small documentation updates, test fixed according to attributes documentation

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@764654 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2009-04-14 00:36:02 +00:00
parent f6f1d00d72
commit 3ef76ae033
4 changed files with 6 additions and 8 deletions

View File

@ -50,12 +50,12 @@ import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
* Field field = new Field(name, stream);
* field.setOmitNorms(true);
* field.setOmitTermFreqAndPositions(true);
* Document doc = new Document();
* document.add(field);
* <em>// use this code to index many documents:</em>
* stream.setValue(value1)
* document.add(field);
* writer.addDocument(document);
* stream.setValue(value2)
* document.add(field);
* writer.addDocument(document);
* ...
* </pre>

View File

@ -50,12 +50,12 @@ import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
* Field field = new Field(name, stream);
* field.setOmitNorms(true);
* field.setOmitTermFreqAndPositions(true);
* Document doc = new Document();
* document.add(field);
* <em>// use this code to index many documents:</em>
* stream.setValue(value1)
* document.add(field);
* writer.addDocument(document);
* stream.setValue(value2)
* document.add(field);
* writer.addDocument(document);
* ...
* </pre>

View File

@ -29,10 +29,9 @@ public class TestIntTrieTokenStream extends LuceneTestCase {
public void testStreamNewAPI() throws Exception {
final IntTrieTokenStream stream=new IntTrieTokenStream(value, precisionStep);
stream.setUseNewAPI(true);
// use getAttribute to test if attributes really exist, if not an IAE will be throwed
final ShiftAttribute shiftAtt = (ShiftAttribute) stream.getAttribute(ShiftAttribute.class);
assertNotNull("Has shift attribute", shiftAtt);
final TermAttribute termAtt = (TermAttribute) stream.getAttribute(TermAttribute.class);
assertNotNull("Has term attribute", termAtt);
for (int shift=0; shift<32; shift+=precisionStep) {
assertTrue("New token is available", stream.incrementToken());
assertEquals("Shift value", shift, shiftAtt.getShift());

View File

@ -29,10 +29,9 @@ public class TestLongTrieTokenStream extends LuceneTestCase {
public void testStreamNewAPI() throws Exception {
final LongTrieTokenStream stream=new LongTrieTokenStream(value, precisionStep);
stream.setUseNewAPI(true);
// use getAttribute to test if attributes really exist, if not an IAE will be throwed
final ShiftAttribute shiftAtt = (ShiftAttribute) stream.getAttribute(ShiftAttribute.class);
assertNotNull("Has shift attribute", shiftAtt);
final TermAttribute termAtt = (TermAttribute) stream.getAttribute(TermAttribute.class);
assertNotNull("Has term attribute", termAtt);
for (int shift=0; shift<64; shift+=precisionStep) {
assertTrue("New token is available", stream.incrementToken());
assertEquals("Shift value", shift, shiftAtt.getShift());