RE: Edit distance and wildcard searching with PhraseQuery

2009-11-11 Thread Jeff Plater
Thanks for the suggestion - I double checked the case and it was OK. Turned out I needed to use the StandardAnalyzer instead of the WhitespaceAnalyzer. -Jeff -Original Message- From: Erick Erickson [mailto:erickerick...@gmail.com] Sent: Wednesday, November 11, 2009 6:52 PM To: java-user@

Re: Wrapping IndexSearcher so that it is safe?

2009-11-11 Thread Jacob Rhoden
The source code for SearcherManager is even downloadable for free: http://www.manning.com/hatcher3/LIAsourcecode.zip The example source code does some things that is beyond my level of understanding of lucene. ie: 1) To me it looks like an IndexSearcher never gets closed. 2) I don't underst

Re: Edit distance and wildcard searching with PhraseQuery

2009-11-11 Thread Erick Erickson
I'd at use something that lowercases the input rather than just WhitespaceAnalyzer. Remember to use it at index time and query time. Between your queries and typing things in e-mails, case is often a gotcha. At least carefully check that your casing is identical. Best Erick On Wed, Nov 11, 2009

RE: Edit distance and wildcard searching with PhraseQuery

2009-11-11 Thread Jeff Plater
Thanks - I tried it out and it seems to work for "Philadelphid~0.75 PA" but I can't get it working for "Phil* PA" yet. Perhaps it is an issue with my Analyzer (I am using WhitespaceAnalyzer)?. Have you used it with wildcard before? -Jeff -Original Message- From: AHMET ARSLAN [mailto:

Re: Edit distance and wildcard searching with PhraseQuery

2009-11-11 Thread AHMET ARSLAN
What you are looking for is ComplexPhraseQueryParser [1] and implemented in Lucene 2.9.0. It uses SpanQuery family. It supports "Phil* PA"~10 as well as "Philadelphid~0.75 PA". Ranges, OR, fuzzy and wildcard inside proximity (phrases). [1] http://lucene.apache.org/java/2_9_0/api/contrib-misc/o

Re: Wrapping IndexSearcher so that it is safe?

2009-11-11 Thread Erick Erickson
If you want to spend a few bucks, here's part of a reply to a similar question from Mike McCandless a day or so ago <<< You can get the book here http://www.manning.com/hatcher3 (NOTE: I'm one of the authors!). Chapter 11 in the book has a class called SearcherManager, that handles the detail

Edit distance and wildcard searching with PhraseQuery

2009-11-11 Thread Jeff Plater
Hi, I am trying to figure out a way that I can query a Lucene index for a phrase but have some fuzziness (edit distance and/or wildcard) applied to the individual terms. An example should help explain what I am trying to do: Index contains: Philadelphia PA Search is done on: Philadel

Re: Wrapping IndexSearcher so that it is safe?

2009-11-11 Thread Jacob Rhoden
I knew I would have overlooked something, thanks for the help! On 12/11/2009, at 9:21 AM, Uwe Schindler wrote: simply do not catch and rethrow the IOException, instead put release in a finally block and let the IOException automatically go upwards. this.retain();

RE: Wrapping IndexSearcher so that it is safe?

2009-11-11 Thread Uwe Schindler
Looks good. About your code: The searcher will not close if any other unchecked exception is thrown. Such code should always use finally blocks. So simply do not catch and rethrow the IOException, instead put release in a finally block and let the IOException automatically go upwards. >

Wrapping IndexSearcher so that it is safe?

2009-11-11 Thread Jacob Rhoden
I am pondering a way to allow closing of an index searcher and releasing the pointer to it so that it automatically cleans up by itself when all threads stop using the index searcher. Inspired by the Objective C retain/release model, what do you think about this? Basically when threads star

RE: Equality Numeric Query

2009-11-11 Thread Uwe Schindler
Thanks! I would still suggest to use a NumericRangeQuery with upper/lower identical and inclusive, because it would not use expert APIs (NumericUtils is such) and is more comfortable to use. As long as you not change the rewrite method, there is no speed difference, as it rewrites to a simple cons

Re: Equality Numeric Query

2009-11-11 Thread Shai Erera
Thanks a lot for the super fast response ! Shai On Wed, Nov 11, 2009 at 4:21 PM, Uwe Schindler wrote: > No. > > - > Uwe Schindler > H.-H.-Meier-Allee 63, D-28213 Bremen > http://www.thetaphi.de > eMail: u...@thetaphi.de > > > > -Original Message- > > From: Shai Erera [mailto:ser...@

RE: Equality Numeric Query

2009-11-11 Thread Uwe Schindler
No. - Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -Original Message- > From: Shai Erera [mailto:ser...@gmail.com] > Sent: Wednesday, November 11, 2009 3:17 PM > To: java-user@lucene.apache.org > Subject: Re: Equality Numeric Que

Re: Equality Numeric Query

2009-11-11 Thread Shai Erera
Thanks ! If I use Yonik's approach, do I need to index the terms in a special way? Shai On Wed, Nov 11, 2009 at 4:13 PM, Uwe Schindler wrote: > Hi Shai, > > In 2.9.1, the approach using upper/lower bound identical and included is > the > official supported usage. The Query is optimized to rewr

RE: Equality Numeric Query

2009-11-11 Thread Uwe Schindler
Hi Shai, In 2.9.1, the approach using upper/lower bound identical and included is the official supported usage. The Query is optimized to rewrite efficient in this case (constant score term query). But you can also use a TermQuery like Yonik suggested and converting the numbers yourself. You wil

Re: Equality Numeric Query

2009-11-11 Thread Yonik Seeley
On Wed, Nov 11, 2009 at 8:54 AM, Shai Erera wrote: > I index documents with numeric fields using the new Numeric package. I > execute two types of queries: range queries (for example, [1 TO 20}) and > equality queries (for example 24.75). Don't mind the syntax. > > Currently, to execute the equali

Equality Numeric Query

2009-11-11 Thread Shai Erera
Hi I index documents with numeric fields using the new Numeric package. I execute two types of queries: range queries (for example, [1 TO 20}) and equality queries (for example 24.75). Don't mind the syntax. Currently, to execute the equality query, I create a NumericRangeQuery with the lower/upp

Re: IndexWriter.close() no longer seems to close everything

2009-11-11 Thread Albert Juhe
I think that this is the best way to proceed. thank you Mike Michael McCandless-2 wrote: > > Can you narrow the leak down to a small self-contained test? > > Mike > > On Wed, Nov 11, 2009 at 5:54 AM, Albert Juhe wrote: >> >> I don't get any exception. >> >> thank you Mike >> >> >> Michael

Re: IndexWriter.close() no longer seems to close everything

2009-11-11 Thread Michael McCandless
Can you narrow the leak down to a small self-contained test? Mike On Wed, Nov 11, 2009 at 5:54 AM, Albert Juhe wrote: > > I don't get any exception. > > thank you Mike > > > Michael McCandless-2 wrote: >> >> Do you see your exception handler printing anything out? >> >> You don't need to close t

Re: IndexWriter.close() no longer seems to close everything

2009-11-11 Thread Albert Juhe
I don't get any exception. thank you Mike Michael McCandless-2 wrote: > > Do you see your exception handler printing anything out? > > You don't need to close the underlying IndexReader, just the > IndexSearcher (which will close the IndexReader, since it was the one > that had opened it). >

Re: IndexWriter.close() no longer seems to close everything

2009-11-11 Thread Michael McCandless
Do you see your exception handler printing anything out? You don't need to close the underlying IndexReader, just the IndexSearcher (which will close the IndexReader, since it was the one that had opened it). Mike On Wed, Nov 11, 2009 at 5:10 AM, Albert Juhe wrote: > > I don't know if it's the

Re: IndexWriter.close() no longer seems to close everything

2009-11-11 Thread Albert Juhe
I don't know if it's the same problem but I think it's similar, My problem is with the Indexsearcher. I've installed a web search engine that uses Lucene, after a search I make a close operation like this: private IndexSearcher searcher; NIOFSDirectory directory = new NIOFSDirectory(new File(p

Re: How to safely close Index objects?

2009-11-11 Thread Michael McCandless
On Wed, Nov 11, 2009 at 12:13 AM, Jacob Rhoden wrote: > Given a class with two static variables, is the following safe? ie If I call > "close" while something else is using the objects, do the objects simply > hold a flag saying they need to be destroyed once the objects are finished > being used