On Monday 13 June 2005 18:37, Kadlabalu, Hareesh wrote:
> I ran into a related problem; when I create an IndexWriter with a
> FSDirectory created with create=true, an existing index would somehow
> get corrupted
Well, it doesn't get corrupted, it gets deleted. That's what create=true is
supposed
Luke Francl wrote:
You may want to try using IndexReader's indexExists family of methods.
They will tell you whether or not an index is there.
http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#indexExists(org.apache.lucene.store.Directory)
Good grief ! I missed th
Hi,
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Stephane Bailliez
>
> What I would like to is something like: if the index does not
> exist, then create one for me, otherwise use it.
Look at IndexReader.indexExists method.
Your code will be like this:
bool createIndex = ! (IndexReade
Hi,
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Stephane Bailliez
>
> What I would like to is something like: if the index does not
> exist, then create one for me, otherwise use it.
Look at IndexReader.indexExists method.
Your code will be like this:
bool createIndex = ! (IndexReade
hello
I'm using following code in the startup of my program
String indexDirectory = //some init
try {
if ( !IndexReader.indexExists(indexDirectory)) {
// working index doesn't exist so try to create a dummy index.
IndexWriter iw = new IndexWriter(indexDirectory, new
St
You may want to try using IndexReader's indexExists family of methods.
They will tell you whether or not an index is there.
http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#indexExists(org.apache.lucene.store.Directory)
Stephane Bailliez wrote:
[...]
try {
writer = new IndexWriter(directory, analyzer, false)
} catch (IOException e){
writer = new IndexWriter(directory, analyzer, true);
}
On a related note, the code above does not work if the index does not
exist because of the lock created by the first
Bailliez [mailto:[EMAIL PROTECTED]
Sent: Monday, June 13, 2005 11:48 AM
To: java-user@lucene.apache.org
Subject: Indexes auto creation
I have a very stupid question that puzzles me so far in the API. (I'm
using Lucene 1.4.3)
There is a boolean flag over the creation of the Directory which is
basi
I have a very stupid question that puzzles me so far in the API. (I'm
using Lucene 1.4.3)
There is a boolean flag over the creation of the Directory which is
basically: use it as is or delete the storage area
Same for the index, the IndexWriter use a flag 'use the existing or
create a new on