dcsimg
How can I compare two or more documents together with Lucene
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Pan_Kal
Posted On:   Tuesday, January 11, 2005 02:44 AM

I have the following incompleted code and I want help with comparring documents. public static void main(String[] args) { RAMDirectory idx = new RAMDirectory(); DisplayAllElements dae = new DisplayAllElements(); try { IndexWriter writer = new IndexWriter(idx, new StandardAnalyzer(), true); writer.addDocument(createDocument(dae.getTitle("data/test.html"),dae.getBody("data/test.html"))); writer.addDocument(createDocument(dae.getTitle("data/test2.html"),dae.getBody("data/test2.html"))); writer.optimize(); writer.close(); ............    More>>

I have the following incompleted code and I want help with comparring documents.


public static void main(String[] args) {


RAMDirectory idx = new RAMDirectory();

DisplayAllElements dae = new DisplayAllElements();

try {

IndexWriter writer = new IndexWriter(idx, new StandardAnalyzer(), true);

writer.addDocument(createDocument(dae.getTitle("data/test.html"),dae.getBody("data/test.html")));

writer.addDocument(createDocument(dae.getTitle("data/test2.html"),dae.getBody("data/test2.html")));

writer.optimize();

writer.close();

............

   <<Less

Re: How can I compare two or more documents together with Lucene

Posted By:   Otis_Gospodnetic  
Posted On:   Tuesday, January 11, 2005 07:54 PM

The first question is: what makes 2 Documents equal? Are 2 Documents equal when all their Fields match? In that case write a custom equals method and compare each Field. Note, however, that you won't be able to get the original text value if you didn't store the text or if you used Reader when constructing the Field.
About | Sitemap | Contact