> -----Original Message-----
> From: Nellaiyappan Gomathinayagam 
> [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, March 04, 2003 5:10 PM
> To: Lucene Users List
> Subject: RE: Lucene Turbine Service
> 
> 
> Hi,
> 
> Any one tried Incremental Indexing with Lucene. If so then 
> kindly guide me how to do that??

What do you mean by 'incremental'? Adding a single entry/document to an index?

public void indexSingleEntry (File indexFile, String id, String cat, String prob, 
String sol){
        IndexWriter writer = null;
        try {
            Analyzer analyzer = new GermanAnalyzer();
            writer = new IndexWriter(indexFile, analyzer, false);
            Document doc = new Document();
            doc.add(Field.Text("id", id));
            doc.add(Field.Text("category", cat));
            doc.add(Field.Text("problem", prob));
            doc.add(Field.UnStored("solution", sol));
            writer.addDocument(doc);

        }
        catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (null != writer) {
                try {
                    writer.close();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
    }


Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to