RE: java.io.IOException: Lock obtain timed out

2004-03-15 Thread Gabe

I figured it out. an errant open IndexWriter. 


--- "Nguyen, Tri (NIH/NLM/LHC)"
<[EMAIL PROTECTED]> wrote:
> Did you close your writer if an Exception occured?
> 
> I had a similiar problem, but it was fixed when i
> close the writer in the
> finally block.
> 
> Below is my original code (which generate
> Mjava.io.Exception: Lock obtain
> timed out when an Exception is thrown)
> 
> public static void index(File indexDir, List cList,
> boolean ow) 
> throws Exception{
> IndexWriter writer = null;
> try{  
> writer = new IndexWriter(indexDir, new
> MyAnalyzer(), overwrite); 
> // index documents
> }
> catch(Exception e){
> writer = new IndexWriter(indexDir, new
> MyAnalyzer(), true);
> try{
> // index documents 
> }
> catch(Exception ee){ 
> throw ee;  
> }
> }
> writer.close();  // never reaches this statement
> if the catch block is
> called.  
> }
> 
> 
> // revised code to force a close on the IndexWriter
> public static void index(File indexDir, List cList,
> boolean ow) 
> throws Exception{
> IndexWriter writer = null;
> try{  
> writer = new IndexWriter(indexDir, new
> MyAnalyzer(), overwrite); 
> // index documents
> writer.close();
> }
> catch(Exception e){
> writer = new IndexWriter(indexDir, new
> MyAnalyzer(), true);
> try{
> // index documents 
> }
> catch(Exception ee){ 
> throw ee;  
> }
> finally{ 
> writer.close(); 
> } 
> }
> }
> 
> 
> 
> -Original Message-
> 
> 
> From: Gabe [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 15, 2004 1:53 PM
> To: Lucene Users List
> Subject: Re: java.io.IOException: Lock obtain timed
> out
> 
> 
> Otis,
> 
> I only put the unlock call in because I had the
> error
> in the first place. Removing it, the IOException
> still
> occurs, when trying to instantiate the IndexWriter.
> 
> Thanks,
> Gabe
> 
> --- Otis Gospodnetic <[EMAIL PROTECTED]>
> wrote:
> > There is no need for that .unlock call, just
> > .close()
> > 
> > Otis
> > 
> > --- Gabe <[EMAIL PROTECTED]> wrote:
> > > 
> > > I am using Lucene 1.3 final and am having an
> error
> > > that I can't seem to shake. Basically, I am
> > updating a
> > > Document in the index incrementally by calling
> an
> > > IndexReader to remove the document. This works.
> > Then,
> > > I close the IndexReader with the following code:
> > > 
> > > reader.unlock(reader.directory());
> > > reader.close();
> > > 
> > > I put the first of the two lines in to try to
> > force
> > > the lock to disable. According to the logging,
> > this
> > > code is being called and the IndexReader is
> being
> > > closed.
> > > 
> > > However, then I open a writer to add the
> document,
> > I
> > > get the following.
> > > 
> > > java.io.IOException: Lock obtain timed out
> > > at
> > >
> org.apache.lucene.store.Lock.obtain(Lock.java:97)
> > > at
> > >
> >
>
org.apache.lucene.index.IndexWriter.(IndexWriter.java:173)
> > > at 
> > > 
> > > ...
> > > 
> > > I open the writer by calling:
> > > return new IndexWriter(INDEX_DIR, analyzer,
> > false);
> > > 
> > > where analyzer=new StandardAnalyzer();
> > > 
> > > I get the reader by calling:
> > > IndexReader reader=IndexReader.open(INDEX_DIR);
> > > 
> > > Thanks for any help,
> > > Gabe
> > > 
> > > __
> > > Do you Yahoo!?
> > > Yahoo! Mail - More reliable, more storage, less
> > spam
> > > http://mail.yahoo.com
> > > 
> > >
> >
>
-
> > > 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]
> > 
> 
> 
> __
> Do you Yahoo!?
> Yahoo! Mail - More reliable, more storage, less spam
> http://mail.yahoo.com
> 
>
-
> 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]
> 


__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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



RE: java.io.IOException: Lock obtain timed out

2004-03-15 Thread Gabe

I notice in your "catch" clause you always set the
writer to be true... (i.e. new IndexWriter(INDEX_DIR,
analyzer, true). 

If I am not mistaken reading the docs, this overwrites
the entire index, no? That is why I was setting that
variable to false when doing an incremental update.
When I reindex all documents, I have had no problem.

Gabe

--- "Nguyen, Tri (NIH/NLM/LHC)"
<[EMAIL PROTECTED]> wrote:
> Did you close your writer if an Exception occured?
> 
> I had a similiar problem, but it was fixed when i
> close the writer in the
> finally block.
> 
> Below is my original code (which generate
> Mjava.io.Exception: Lock obtain
> timed out when an Exception is thrown)
> 
> public static void index(File indexDir, List cList,
> boolean ow) 
> throws Exception{
> IndexWriter writer = null;
> try{  
> writer = new IndexWriter(indexDir, new
> MyAnalyzer(), overwrite); 
> // index documents
> }
> catch(Exception e){
> writer = new IndexWriter(indexDir, new
> MyAnalyzer(), true);
> try{
> // index documents 
> }
> catch(Exception ee){ 
> throw ee;  
> }
> }
> writer.close();  // never reaches this statement
> if the catch block is
> called.  
> }
> 
> 
> // revised code to force a close on the IndexWriter
> public static void index(File indexDir, List cList,
> boolean ow) 
> throws Exception{
> IndexWriter writer = null;
> try{  
> writer = new IndexWriter(indexDir, new
> MyAnalyzer(), overwrite); 
> // index documents
> writer.close();
> }
> catch(Exception e){
> writer = new IndexWriter(indexDir, new
> MyAnalyzer(), true);
> try{
> // index documents 
> }
> catch(Exception ee){ 
> throw ee;  
> }
> finally{ 
> writer.close(); 
> } 
> }
> }
> 
> 
> 
> -Original Message-
> 
> 
> From: Gabe [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 15, 2004 1:53 PM
> To: Lucene Users List
> Subject: Re: java.io.IOException: Lock obtain timed
> out
> 
> 
> Otis,
> 
> I only put the unlock call in because I had the
> error
> in the first place. Removing it, the IOException
> still
> occurs, when trying to instantiate the IndexWriter.
> 
> Thanks,
> Gabe
> 
> --- Otis Gospodnetic <[EMAIL PROTECTED]>
> wrote:
> > There is no need for that .unlock call, just
> > .close()
> > 
> > Otis
> > 
> > --- Gabe <[EMAIL PROTECTED]> wrote:
> > > 
> > > I am using Lucene 1.3 final and am having an
> error
> > > that I can't seem to shake. Basically, I am
> > updating a
> > > Document in the index incrementally by calling
> an
> > > IndexReader to remove the document. This works.
> > Then,
> > > I close the IndexReader with the following code:
> > > 
> > > reader.unlock(reader.directory());
> > > reader.close();
> > > 
> > > I put the first of the two lines in to try to
> > force
> > > the lock to disable. According to the logging,
> > this
> > > code is being called and the IndexReader is
> being
> > > closed.
> > > 
> > > However, then I open a writer to add the
> document,
> > I
> > > get the following.
> > > 
> > > java.io.IOException: Lock obtain timed out
> > > at
> > >
> org.apache.lucene.store.Lock.obtain(Lock.java:97)
> > > at
> > >
> >
>
org.apache.lucene.index.IndexWriter.(IndexWriter.java:173)
> > > at 
> > > 
> > > ...
> > > 
> > > I open the writer by calling:
> > > return new IndexWriter(INDEX_DIR, analyzer,
> > false);
> > > 
> > > where analyzer=new StandardAnalyzer();
> > > 
> > > I get the reader by calling:
> > > IndexReader reader=IndexReader.open(INDEX_DIR);
> > > 
> > > Thanks for any help,
> > > Gabe
> > > 
> > > __
> > > Do you Yahoo!?
> > > Yahoo! Mail - More reliable, more storage, less
> > spam
> > > http://mail.yahoo.com
> > > 
> > >
> >
>
-
> > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > [EMAIL PRO

Re: java.io.IOException: Lock obtain timed out

2004-03-15 Thread Gabe

Otis,

I only put the unlock call in because I had the error
in the first place. Removing it, the IOException still
occurs, when trying to instantiate the IndexWriter.

Thanks,
Gabe

--- Otis Gospodnetic <[EMAIL PROTECTED]>
wrote:
> There is no need for that .unlock call, just
> .close()
> 
> Otis
> 
> --- Gabe <[EMAIL PROTECTED]> wrote:
> > 
> > I am using Lucene 1.3 final and am having an error
> > that I can't seem to shake. Basically, I am
> updating a
> > Document in the index incrementally by calling an
> > IndexReader to remove the document. This works.
> Then,
> > I close the IndexReader with the following code:
> > 
> > reader.unlock(reader.directory());
> > reader.close();
> > 
> > I put the first of the two lines in to try to
> force
> > the lock to disable. According to the logging,
> this
> > code is being called and the IndexReader is being
> > closed.
> > 
> > However, then I open a writer to add the document,
> I
> > get the following.
> > 
> > java.io.IOException: Lock obtain timed out
> > at
> > org.apache.lucene.store.Lock.obtain(Lock.java:97)
> > at
> >
>
org.apache.lucene.index.IndexWriter.(IndexWriter.java:173)
> > at 
> > 
> > ...
> > 
> > I open the writer by calling:
> > return new IndexWriter(INDEX_DIR, analyzer,
> false);
> > 
> > where analyzer=new StandardAnalyzer();
> > 
> > I get the reader by calling:
> > IndexReader reader=IndexReader.open(INDEX_DIR);
> > 
> > Thanks for any help,
> > Gabe
> > 
> > __
> > Do you Yahoo!?
> > Yahoo! Mail - More reliable, more storage, less
> spam
> > http://mail.yahoo.com
> > 
> >
>
-
> > 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]
> 


__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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



java.io.IOException: Lock obtain timed out

2004-03-15 Thread Gabe

I am using Lucene 1.3 final and am having an error
that I can't seem to shake. Basically, I am updating a
Document in the index incrementally by calling an
IndexReader to remove the document. This works. Then,
I close the IndexReader with the following code:

reader.unlock(reader.directory());
reader.close();

I put the first of the two lines in to try to force
the lock to disable. According to the logging, this
code is being called and the IndexReader is being
closed.

However, then I open a writer to add the document, I
get the following.

java.io.IOException: Lock obtain timed out
at
org.apache.lucene.store.Lock.obtain(Lock.java:97)
at
org.apache.lucene.index.IndexWriter.(IndexWriter.java:173)
at 

...

I open the writer by calling:
return new IndexWriter(INDEX_DIR, analyzer, false);

where analyzer=new StandardAnalyzer();

I get the reader by calling:
IndexReader reader=IndexReader.open(INDEX_DIR);

Thanks for any help,
Gabe

__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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



Re: Ordering by a field value

2004-02-10 Thread Gabe

Thanks Otis.

What will the names of the relevant files be and will
I be able to use 1.3 final still (simply integrating
the contributions into my own code) or would I have to
go with the latest code from CVS?

Thanks again,
Gabe

--- Otis Gospodnetic <[EMAIL PROTECTED]>
wrote:
> There were some recent contributions that should
> make this possible and
> simple to do.
> The code should be added to Lucene CVS repository in
> the next week or
> so.
> 
> Otis
> 
> --- Gabe <[EMAIL PROTECTED]> wrote:
> > 
> > Hi,
> > 
> > I was wondering whether it was possible to sort
> search
> > results by the order of the String value of a
> stored
> > or unstored field. How would one implement this?
> > 
> > Thanks,
> > Gabe
> > 
> > __
> > Do you Yahoo!?
> > Yahoo! Finance: Get your refund fast by filing
> online.
> > http://taxes.yahoo.com/filing.html
> > 
> >
>
-
> > 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]
> 


__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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



Ordering by a field value

2004-02-09 Thread Gabe

Hi,

I was wondering whether it was possible to sort search
results by the order of the String value of a stored
or unstored field. How would one implement this?

Thanks,
Gabe

__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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



arrays of values in a field

2004-01-27 Thread Gabe

If I have a group of documents and I want to filter on
a category, it is fairly straightforward. I just
create a Field that contains the category and filter
on it. 

However, what if I want the field "category" to have
multiple possible values? Is there a known best way to
filter on that? 

I imagine it is possible to "hack" it by, say,
creating a field with value:
|category1|category2|category3| etc. 

And then query "|category1|"

I was wondering if there was a better way.

Thanks,
Gabe

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

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