Eh, I was looking at these Factories just the other day and wondering about the 
similar stuff as Daniel.
Regarding reflection - even if reflection is slower, and I'm sure it is, I just 
don't know exactly how much slower it is, couldn't we cache the instantiated 
instances keyed off by name?  Such instances would have to be thread-safe, but 
I imagine most/all Tokenizers already are thread-safe.

Daniel, I suggest you take that UbberTokenizerFactory code, slap ASL 2.0 on top 
of it, add simple instance caching as mentioned above, and post the code to 
JIRA.

Otis
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Simpy -- http://www.simpy.com/  -  Tag  -  Search  -  Share

----- Original Message ----
From: Chris Hostetter <[EMAIL PROTECTED]>
To: solr-user@lucene.apache.org
Sent: Thursday, June 21, 2007 9:39:20 PM
Subject: Re: add CJKTokenizer to solr


: Why instead of that we don't create an UbberFactory that takes the Tokenizer
: class as a parameter and instantiates the proper Tokenizer?

The idea has come up before ... and there's really no reason why it
wouldn't be okay to include a reflection based facotry like this in Solr
-- it just hasn't been done yet.

One of the reasons is that there are some performance costs associated
with the reflection, so we wouldn't want to competley replace the existing
"configuration via factory name" model with a "configure via class name
and an uber factory does the reflection quetly in the background" model
because it's the kind of appraoch that would really only make sense for
simple prototypes -- in any system where you are really concerned about
performacne, reflection on every analyzer call would probably be pretty
expensive.  (allthough i'd love to see benchmarks prove me wrong)

Another question in my mind is "why doesn't solr provide an optional jar
with factories for every tokenizer/tokenfilter in the lucene contribs?"
... the only answer to that is that no one has bothered to crank out a
patch that does it.

http://www.nabble.com/Re%3A-making-schema.xml-nicer-to-read-use-p5939980.html
http://www.nabble.com/foo-tf1737025.html#a4720545


-Hoss




Reply via email to