Can we perform Database operations using Lucene??
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shridhar_N
Posted On:   Sunday, January 8, 2006 10:34 PM

Hi All,

I am new to this lucene.
I want to do Lucene operations in SQL Database..

1. Can we perform Database operations using Lucene..
2. How is the performace as compared to file search..




Also, can any one gimme a sample java code with lucene using Database..



Any help would be highly appreciated..
Thanks in Advance..
Shridhar..

Re: Can we perform Database operations using Lucene??

Posted By:   Anonymous  
Posted On:   Monday, January 23, 2006 06:35 AM

Hi,


I'm using Lucene to find items stored in a database.
The way I implemented this is:
- get the records from the database, and create a Document with each row, with the primary key as a Keyword. Store that document in the Lucene file-based index.
- use Lucene to search Documents
- whenever you need to act on the database, get the primary key id and use it for your operations
- whenever you modify the database, update the index as well



I'm not sure that Lucene is meant to be used to query a database directly. You might want to use it to implement full text searching of your database, and all those cool features (+, - OR, AND, "exact phrase", etc). I did that the way I described above. I managed to get lightning fast search performances, and a painless index update process. The items that I'm searching aren't updated often, and using Lucene I saved many many database connections and boosted the search performance drastically.


There are many tutorials to show the update mechanism usually implemented (delete the Document then add it again). You might as well consider purchasing Lucene in Action from Mannings, which I just bought and is a really good book.


Good luck,
St├ęphane

Re: Can we perform Database operations using Lucene??

Posted By:   Otis_Gospodnetic  
Posted On:   Monday, January 9, 2006 08:47 PM

Lucene using a database? That's a vague question. Lucene indexing+searching a database? Lucene storing its index in a database? Something else?

As for file search, look at this. You can try it (download the code) and compare it to alternative ways of file searching.
About | Sitemap | Contact