Question

lucene.net always store index data in flat file like this way.....here is sample code which create index and store index data in flat file.

String sql = "select id, firstname, lastname, phone, email from person";
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
    Document doc = new Document();
    doc.add(new Field("id", rs,getString("id"), Field.Store.YES, Field.Index.UN_TOKENIZED));
    doc.add(new Field("firstname", rs,getString("firstname"), Field.Store.YES, Field.Index.TOKENIZED));  
    // ... repeat for each column in result set
    writer.addDocument(doc);
}

so just guide me how i can store lucene.net index data to sql server table instead of flat file....is it possible....if yes then guide me. thanks

Was it helpful?

Solution

The whole idea of using Lucene is not to use a database. Lucene index files are optmized to do what it does best, search.

If you want to use a database and since you are using SqlServer go with FullText Search instead.

Lucene is an option for database servers that does not have full text search capabilities (of course it does more, but the primary usage is that).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top