You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Caughey, Michael" <mc...@trigon.com> on 2002/11/08 23:22:13 UTC

Indexing Db Table -- Better way request

Hello,

I'm new to Lucene and this group, if it is improper to send such a message
to this group I apologize.  I tried to do a reasonable amount of up front
research before coming here.  

I'm about to undertake a piece of my project where I've decided that Lucene
will be of use.  I have been researching, over the past two week's, ways to
accomplish this.  I know I'll use an indexWriter to write the index to a
file, but I'm having difficultly settling on how to process the data to be
indexed.  

What I have is a table in a MySQL database called items.  I want to be able
to search on a couple of fields and have it return the ID:
Fields:
=========
Name			VARCHAR (80)
Description		TEXT
Location		VARCHAR (80)
Qty			int
ExpireDate		Long		YYYYMMDD
Category		int
ListingPrice		FLOAT(9,2)
Supplier		int

Return
=========  
ItemId			int


On start up of the application every row in the database will be read.
After that I need to keep the table and the index in sync.  Data in the
columns can change, rows can be added and removed.  I have a centeral entity
controller which is responsible for all access to that table.  

I figured on approach which would work would be on start up to read each row
and build an XML document and submit it to the IndexWriter.  
As Inserts, Deletes and updates occurred I could modify both lucene and the
database.

Seems simple enough, and may be the only way to handle it.  Before I did it
I wanted to make sure that there wasn't a better way.  
Are there documents which can automatically read the table and build a
document?  
Should I read the row and just build fields and construct a document?

Does anyone see any problems with storing it in memory versus writing it to
a file?  Or should I say at point would you consider writing it to a file,
would you base that on total document size?  I feel that a file index will
most likely be just fine.

Thanks in advance for any suggestions.






Michael Caughey