Re: Windows Bug?

2004-11-08 Thread yahootintin . 1247688
Thanks!  I just figured that out.  I was passing true by mistake.



--- Lucene
Users List" <[EMAIL PROTECTED] wrote:

The reason this is failing
is because you are trying to create a new

> index in the directory.  It works
on *nix file systems because you can

> delete an open file on those operating
systems, something you can't do

> under Windows.

> 

> If you change the
create parameter to false on your second call

> everything should work as
you expect it to.

> 

> 

> On 8 Nov 2004 18:27:12 -, [EMAIL PROTECTED]

> <[EMAIL PROTECTED]> wrote:

> > Hi,

> > 

> > My understanding
is that I can have an IndexReader open for searching

> > (as long as it doesn't
delete) while an IndexWriter is updating the index.

> > 

> > I wrote a simple
test app to prove this and it works great on Mac OS

> > X, Java 1.4.2 and
Lucene 1.4.2.  It fails on Windows XP, Java 1.4.2 and Lucene

> > 1.4.2. 
I tried other versions of Lucene and it failed in those too.

> > 

> > This

> > is the app that fails on Windows:

> > 

> > public static void main(String[]
args)

> > 

> > throws Exception {

> > 

> >   String indexFolder = "/TestIndex";

> > 

> >   // add

> > a document to the index

> > 

> >   IndexWriter
indexWriter = new IndexWriter

> > 

> > (indexFolder,

> > 

> >  new
StandardAnalyzer(), true);

> > 

> >   Document document =

> > new Document();

> > 

> >   Field field = new Field("foo", "bar",

> > 

> >true,
true, true)

> > 

> >   document.add(field);

> > 

> >   indexWriter.addDocument(document);

> > 

> >   indexWriter.close();

> > 

> >   // open an index reader but
don't close it

> > 

> >  IndexReader indexReader =

> > 

> > IndexReader.open(indexFolder);

> > 

> >   // open

> > an index writer

> > 

> >   indexWriter = new IndexWriter

> > 

> > (indexFolder,

> > 

> >  new StandardAnalyzer(), true);

>
> 

> >   indexWriter.close();

> > 

> > }

> > 

> > On Windows XP

> >
this throws an Exception as soon as it tries to open the IndexWriter after

> > the IndexReader has been opened.

> > 

> > Here's the stack trace:

> > 

> > Exception in

> > thread "main" java.io.IOException: Cannot delete
_1.cfs

> > 

> >   at org.apache.lucene.store.FSDirectory.create(FSDirectory.java:144)

> > 

> >   at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:105)

> > 

> >   at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:83)

> > 

> >   at org.apache.lucene.index.IndexWriter.(IndexWriter.java:173)

> > 

> > at scratch.TestLuceneLocks.main(TestLuceneLocks.java:17)

> > 

> > Is this a bug?

> > 

> > Thanks.

> > 

> > -

> > To unsubscribe, e-mail: [EMAIL PROTECTED]

>
> For additional commands, e-mail: [EMAIL PROTECTED]

>
> 

> >

> 

> -

> To unsubscribe, e-mail: [EMAIL PROTECTED]

> For
additional commands, e-mail: [EMAIL PROTECTED]

> 

> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Windows Bug?

2004-11-08 Thread Justin Swanhart
The reason this is failing is because you are trying to create a new
index in the directory.  It works on *nix file systems because you can
delete an open file on those operating systems, something you can't do
under Windows.

If you change the create parameter to false on your second call
everything should work as you expect it to.


On 8 Nov 2004 18:27:12 -, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hi,
> 
> My understanding is that I can have an IndexReader open for searching
> (as long as it doesn't delete) while an IndexWriter is updating the index.
> 
> I wrote a simple test app to prove this and it works great on Mac OS
> X, Java 1.4.2 and Lucene 1.4.2.  It fails on Windows XP, Java 1.4.2 and Lucene
> 1.4.2.  I tried other versions of Lucene and it failed in those too.
> 
> This
> is the app that fails on Windows:
> 
> public static void main(String[] args)
> 
> throws Exception {
> 
>   String indexFolder = "/TestIndex";
> 
>   // add
> a document to the index
> 
>   IndexWriter indexWriter = new IndexWriter
> 
> (indexFolder,
> 
>  new StandardAnalyzer(), true);
> 
>   Document document =
> new Document();
> 
>   Field field = new Field("foo", "bar",
> 
>true, true, true)
> 
>   document.add(field);
> 
>   indexWriter.addDocument(document);
> 
>   indexWriter.close();
> 
>   // open an index reader but don't close it
> 
>  IndexReader indexReader =
> 
> IndexReader.open(indexFolder);
> 
>   // open
> an index writer
> 
>   indexWriter = new IndexWriter
> 
> (indexFolder,
> 
>  new StandardAnalyzer(), true);
> 
>   indexWriter.close();
> 
> }
> 
> On Windows XP
> this throws an Exception as soon as it tries to open the IndexWriter after
> the IndexReader has been opened.
> 
> Here's the stack trace:
> 
> Exception in
> thread "main" java.io.IOException: Cannot delete _1.cfs
> 
>   at org.apache.lucene.store.FSDirectory.create(FSDirectory.java:144)
> 
>   at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:105)
> 
>   at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:83)
> 
>   at org.apache.lucene.index.IndexWriter.(IndexWriter.java:173)
> 
> at scratch.TestLuceneLocks.main(TestLuceneLocks.java:17)
> 
> Is this a bug?
> 
> Thanks.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Windows Bug?

2004-11-08 Thread yahootintin . 1247688
Hi,



My understanding is that I can have an IndexReader open for searching
(as long as it doesn't delete) while an IndexWriter is updating the index.
 



I wrote a simple test app to prove this and it works great on Mac OS
X, Java 1.4.2 and Lucene 1.4.2.  It fails on Windows XP, Java 1.4.2 and Lucene
1.4.2.  I tried other versions of Lucene and it failed in those too.



This
is the app that fails on Windows:



public static void main(String[] args)


throws Exception {

  String indexFolder = "/TestIndex";

 

  // add
a document to the index

  IndexWriter indexWriter = new IndexWriter

   
(indexFolder, 

 new StandardAnalyzer(), true);

  Document document =
new Document();

  Field field = new Field("foo", "bar", 

  
   true, true, true)

  document.add(field);

  indexWriter.addDocument(document);

  indexWriter.close();



  // open an index reader but don't close it


 IndexReader indexReader =

IndexReader.open(indexFolder);



  // open
an index writer

  indexWriter = new IndexWriter

(indexFolder, 

   
 new StandardAnalyzer(), true);

  indexWriter.close();

}



On Windows XP
this throws an Exception as soon as it tries to open the IndexWriter after
the IndexReader has been opened.



Here's the stack trace:

Exception in
thread "main" java.io.IOException: Cannot delete _1.cfs

  at org.apache.lucene.store.FSDirectory.create(FSDirectory.java:144)

  at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:105)

  at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:83)

  at org.apache.lucene.index.IndexWriter.(IndexWriter.java:173)

 
at scratch.TestLuceneLocks.main(TestLuceneLocks.java:17)



Is this a bug?



Thanks.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]