mirror of https://github.com/apache/lucene.git
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:
parent
f6f1d00d72
commit
3ef76ae033
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue