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 Anthony Vito <an...@gmail.com> on 2005/06/07 17:18:15 UTC

Re: Using jdbcdirectory

On Wed, 2005-05-18 at 17:30 +0200, Ivan Frade wrote:
> Hello,
> 
>  I'm trying to use JDBCDirectory in my project. Now (the project) is
> working fine with FSDirectory, but if i simple replace FSDirectory with
> JDBCDirectory the things don't go well: I can create the index, but when
> try to connect (to insert a document) i find a corrupted index. Looking
> database content, i found "segmets" file with 0 bytes length.
> 
>  My questions are:
> 
> * Is this a problem of JDBCDirectory or i'm using it in wrong way (I use
> the _same_ code i run with FSDirectory)
> * Exists other alternatives to JDBCDirectory to store the index in a
> database? (mysql or oracle)
> 
>  Thank you, excuse me my english
> 
> Frade

 Thanks for trying out JDBCDirectory. The problem you are having is with
the way I designed JDBCDirectory. I designed it to solved a business
problem. I index a whole bunch of stuff _once_ and from there I use the
index as read only. Because of this, I implemented it to only write out
the file lengths when the directory is closed. So the steps you need to
take to use the JDBCDirectory v0.05 are...

1) open up a JDBCDirectory object.
2) insert all your documents.
3) close the JDBCDirectory object.
---
in your 'searching' program
1) open up a JDBCDirectory object on the same index
2) start searching


 Lately I have been working on my own time to correct this and some
other issues with JDBCDirectory. The latest features I'm working toward
are:

- File lengths updated on write.
    This is done, except.. I'm not sure how well this will work yet with
multiple JDBCDirectory objects access the same index. Some deeper
locking may be needed, or maybe not...
- Works out of the box with Postgres.
    Not done yet. Thanks to the work of a contributer I should be able
to support postgres with the same code base, and no abstraction.
- Autocommit can be on or off
    This is done. Also, leaving it off will provide a speed boost.( I
think) ( The length writes are committed with data writes. )

 I recently moved so I put up a temporary site,
http://www.anthonyvito.com ,where you can download the latest
development code from. Don't expect any miracles, but it might work for
you with a bit of hacking. Send back comments, issues.. Thanks!!

 Make sure you look at the AbstractTestCase for how to setup statement
pools in your application. You want that or everything will be much
slower.


-- 
Anthony Vito
Software Engineer
Perspective Partners LLC
vito@perspectivepartners.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org