Re: Excessive use of IOException without proper documentation

2012-11-04 Thread Shai Erera
I think that specific exceptions should be thrown only in case we expect the user to do something with it. E.g. LockObtainException is something that I can catch and try to recover from in the code, maybe retry to obtain the lock. But all IOExceptions, maybe excluding FNFE, are unrecoverable in th

Re: Excessive use of IOException without proper documentation

2012-11-04 Thread Trejkaz
On Mon, Nov 5, 2012 at 4:25 AM, Michael-O <1983-01...@gmx.net> wrote: > Continuing my answer from above. Have you ever worked with the Spring > Framework? They apply a very nice exception translation pattern. All > internal exceptions are turned to specialized unchecked exceptions like > Authentica

Re: Questions about lucene TokenStream

2012-11-04 Thread lukai
thanks, Uwe. I missed it. On Sun, Nov 4, 2012 at 3:04 PM, Uwe Schindler wrote: > As explained in my first eMail, the class of the implementation is cached, > not the instance. The factory returns a new instance of the cached class. > > Uwe > > > > lukai schrieb: > > >Hi, thanks for the reply. C

Re: Questions about lucene TokenStream

2012-11-04 Thread Uwe Schindler
As explained in my first eMail, the class of the implementation is cached, not the instance. The factory returns a new instance of the cached class. Uwe lukai schrieb: >Hi, thanks for the reply. Could you elaborate "The AttributeFactory >creates >a new one for every new TokenStream instance.

Re: Questions about lucene TokenStream

2012-11-04 Thread lukai
Hi, thanks for the reply. Could you elaborate "The AttributeFactory creates a new one for every new TokenStream instance." ? because i only find the implementation like this: private static Class getClassForInterface(Class attClass) { final WeakReference> ref = attClassImplMap.get(attCla

RE: Questions about lucene TokenStream

2012-11-04 Thread Uwe Schindler
Hi, > Hmmm, the reason i asked this question is regarding to implementation of : > > CharTermAttribute. > > > It seems tokenizer will set token read from reader into it, and the following > tokenstream can also get this instance. My concern is in a multi-thread > envioment. another thread can

Re: Questions about lucene TokenStream

2012-11-04 Thread lukai
Hmmm, the reason i asked this question is regarding to implementation of : CharTermAttribute. It seems tokenizer will set token read from reader into it, and the following tokenstream can also get this instance. My concern is in a multi-thread envioment. another thread can also change the conte

RE: Questions about lucene TokenStream

2012-11-04 Thread Uwe Schindler
Hi, > I have two confused questions regarding Lucene implementation, hope > someone can give me some clues. > > 1. It's about the AttributeSource/AttributeSourceImpl implemenation. > Seems like the default instance was kept as "static" > in DefaultAttributeFactory. But we get these instances i

Re: Excessive use of IOException without proper documentation

2012-11-04 Thread Michael-O
Shalom Shai, Am 2012-11-04 20:25, schrieb Shai Erera: Hey Mike, I'm not sure that I like the idea of throwing LuceneException or SearchException everywhere. I've been there (long time ago) and I always hated it. Not everywhere but in the top-level API would be sufficient. Some code is never

Re: Excessive use of IOException without proper documentation

2012-11-04 Thread Simon Willnauer
On Sun, Nov 4, 2012 at 8:25 PM, Shai Erera wrote: > Hey Mike, > > I'm not sure that I like the idea of throwing LuceneException or > SearchException everywhere. I've been there (long time ago) and I always > hated it. > > First, what's the difference between 'new SearchException("Failed to read >

Re: Excessive use of IOException without proper documentation

2012-11-04 Thread Shai Erera
Hey Mike, I'm not sure that I like the idea of throwing LuceneException or SearchException everywhere. I've been there (long time ago) and I always hated it. First, what's the difference between 'new SearchException("Failed to read the index", ioe)' and 'new IOException("Failed to read the index"

Re: Excessive use of IOException without proper documentation

2012-11-04 Thread Michael-O
Hi Simon, there are generally two very good resources how exceptions should be handled in Java. I will quote both: 1. Oracle's JavaDoc Style Guide: http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#throwstag 2. Joshua Bloch's book Effective Java, chapter 9: http:/

Re: using CharFilter to inject a space

2012-11-04 Thread Jack Krupansky
I still think that we're looking at an "XY Problem" here, haggling over a "solution" when the problem has not been clearly and fully stated. In particular, rather than parsing straight natural language text, the data appears to have a structured form. Until the structure is fully defined, deta

Re: using CharFilter to inject a space

2012-11-04 Thread Erick Erickson
Ahh, I don't know of a better way. I can imagine complex solutions involving something akin to WordDelimiterFilter... and I can imagine that that would be ridiculously expensive to maintain when there are really simple solutions like you're looking at. Mostly I was curious about your use-case