mirror of https://github.com/apache/lucene.git
small refactoring
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
747a6cce17
commit
ac7576a81c
|
@ -37,40 +37,23 @@ import java.util.LinkedList;
|
||||||
* @author Otis Gospodnetic, Daniel Naber
|
* @author Otis Gospodnetic, Daniel Naber
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class TestMultiPhraseQuery
|
public class TestMultiPhraseQuery extends TestCase
|
||||||
extends TestCase
|
|
||||||
{
|
{
|
||||||
public TestMultiPhraseQuery(String name)
|
public TestMultiPhraseQuery(String name)
|
||||||
{
|
{
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void testPhrasePrefix() throws IOException
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void testPhrasePrefix()
|
|
||||||
throws IOException
|
|
||||||
{
|
{
|
||||||
RAMDirectory indexStore = new RAMDirectory();
|
RAMDirectory indexStore = new RAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true);
|
IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true);
|
||||||
Document doc1 = new Document();
|
add("blueberry pie", writer);
|
||||||
Document doc2 = new Document();
|
add("blueberry strudel", writer);
|
||||||
Document doc3 = new Document();
|
add("blueberry pizza", writer);
|
||||||
Document doc4 = new Document();
|
add("blueberry chewing gum", writer);
|
||||||
Document doc5 = new Document();
|
add("bluebird pizza", writer);
|
||||||
Document doc6 = new Document();
|
add("piccadilly circus", writer);
|
||||||
doc1.add(new Field("body", "blueberry pie", Field.Store.YES, Field.Index.TOKENIZED));
|
|
||||||
doc2.add(new Field("body", "blueberry strudel", Field.Store.YES, Field.Index.TOKENIZED));
|
|
||||||
doc3.add(new Field("body", "blueberry pizza", Field.Store.YES, Field.Index.TOKENIZED));
|
|
||||||
doc4.add(new Field("body", "blueberry chewing gum", Field.Store.YES, Field.Index.TOKENIZED));
|
|
||||||
doc5.add(new Field("body", "bluebird pizza", Field.Store.YES, Field.Index.TOKENIZED));
|
|
||||||
doc6.add(new Field("body", "piccadilly circus", Field.Store.YES, Field.Index.TOKENIZED));
|
|
||||||
writer.addDocument(doc1);
|
|
||||||
writer.addDocument(doc2);
|
|
||||||
writer.addDocument(doc3);
|
|
||||||
writer.addDocument(doc4);
|
|
||||||
writer.addDocument(doc5);
|
|
||||||
writer.addDocument(doc6);
|
|
||||||
writer.optimize();
|
writer.optimize();
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
|
@ -135,4 +118,11 @@ public class TestMultiPhraseQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void add(String s, IndexWriter writer) throws IOException
|
||||||
|
{
|
||||||
|
Document doc = new Document();
|
||||||
|
doc.add(new Field("body", s, Field.Store.YES, Field.Index.TOKENIZED));
|
||||||
|
writer.addDocument(doc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue