Skip to content

Commit

Permalink
UpdateDocument now uses updateDocument() method
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuke committed Apr 5, 2011
1 parent 4f7c7a3 commit 5a49e05
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/test/java/luceneexamples/UpdateDocument.java
Expand Up @@ -22,6 +22,7 @@
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.TopDocs;
Expand Down Expand Up @@ -56,14 +57,12 @@ public void index() throws Exception {
TopDocs td = searcher.search(parser.parse("fox"), 1000);
assertThat(td.totalHits, is(1));

writer.deleteDocuments(parser.parse("id:001"));

Document doc2 = new Document();
doc.add(new Field("id", "001",
Field.Store.YES, Field.Index.NOT_ANALYZED));
doc2.add(new Field("str_field", "quick brown fox jumped over the lazy whale.",
Field.Store.YES, Field.Index.ANALYZED));
writer.addDocument(doc2);
writer.updateDocument(new Term("id", "001"),doc2);
writer.commit();

searcher.close();
Expand Down

0 comments on commit 5a49e05

Please sign in to comment.