lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject cvs commit: jakarta-lucene/src/test/org/apache/lucene/search TestMultiPhraseQuery.java
Date Wed, 10 Nov 2004 13:59:23 GMT
dnaber      2004/11/10 05:59:23

  Modified:    src/test/org/apache/lucene/search TestMultiPhraseQuery.java
  Log:
  small refactoring
  
  Revision  Changes    Path
  1.4       +16 -26    jakarta-lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java
  
  Index: TestMultiPhraseQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestMultiPhraseQuery.java	10 Nov 2004 13:55:23 -0000	1.3
  +++ TestMultiPhraseQuery.java	10 Nov 2004 13:59:23 -0000	1.4
  @@ -37,40 +37,23 @@
    * @author Otis Gospodnetic, Daniel Naber
    * @version $Id$
    */
  -public class TestMultiPhraseQuery
  -    extends TestCase
  +public class TestMultiPhraseQuery extends TestCase
   {
       public TestMultiPhraseQuery(String name)
       {
           super(name);
       }
   
  -    /**
  -     *
  -     */
  -    public void testPhrasePrefix()
  -        throws IOException
  +    public void testPhrasePrefix() throws IOException
       {
           RAMDirectory indexStore = new RAMDirectory();
           IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true);
  -        Document doc1 = new Document();
  -        Document doc2 = new Document();
  -        Document doc3 = new Document();
  -        Document doc4 = new Document();
  -        Document doc5 = new Document();
  -        Document doc6 = new Document();
  -        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);
  +        add("blueberry pie", writer);
  +        add("blueberry strudel", writer);
  +        add("blueberry pizza", writer);
  +        add("blueberry chewing gum", writer);
  +        add("bluebird pizza", writer);
  +        add("piccadilly circus", writer);
           writer.optimize();
           writer.close();
   
  @@ -134,5 +117,12 @@
             // okay, all terms must belong to the same field
           }
   
  +    }
  +    
  +    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);
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message