[hibernate-dev] [HSearch] Upgrade to Lucene 3.0

Hardy Ferentschik hibernate at ferentschik.de
Thu Sep 9 09:15:19 EDT 2010


Right,  I see where you are coming from, but I still think it is  
problematic.
Yes we instantiate the factory somewhere in SolrAnalyzerBuilder, but my  
point is
that because the Solr class is referenced in my entity, it also has to be  
on the classpath.
If the main class loader cannot find  
org.apache.solr.analysis.StandardTokenizerFactory it will
throw an exception.
Your idea would work if the factory parameter would just be the class name  
as string.

Or am I missing something here?

--Hardy

On Thu, 09 Sep 2010 15:00:58 +0200, Sanne Grinovero  
<sanne.grinovero at gmail.com> wrote:

> What I mean is that when you read the annotation having
> @TokenizerDef(factory =  
> org.apache.solr.analysis.StandardTokenizerFactory.class)
>
> you could try starting it, but if it doesn't work you do
> factory.getName().replace("org.apache.solr",
> "org.hibernate.search.analysis")
> and then use the new one loaded by reflection, after spitting out a
> fat warning about the fact that you're messing with it, and that the
> user will get a different class than what he asked for.
> If the "translated name" points to a non-existent class, something
> else is wrong.




More information about the hibernate-dev mailing list