|
|
Grant Ingersoll 2007-12-28, 21:05
I have a custom Similarity class that I would like to load. It has a no-arg constructor, so it should work fine within Solr's context. However, it has the option for other constructor input values as well that I would like to be able to set. Is there a way to set these values in Solr via the schema.xml declaration? In looking at IndexSchema.java, it seems like it is not supported, but I was wondering if I was missing something.
In the past, I have used Digester/Beans to do these kinds of things.
I also have this issue for some Analyzers, but that is not as pressing at the moment.
Thanks, Grant
Yonik Seeley 2007-12-28, 21:17
On Dec 28, 2007 4:05 PM, Grant Ingersoll <[EMAIL PROTECTED]> wrote: > I have a custom Similarity class that I would like to load. It has a > no-arg constructor, so it should work fine within Solr's context. > However, it has the option for other constructor input values as well > that I would like to be able to set. Is there a way to set these > values in Solr via the schema.xml declaration? In looking at > IndexSchema.java, it seems like it is not supported, but I was > wondering if I was missing something.
One option for a custom similarity is to have it implement the NamedListInitializedPlugin interface. Solr would have to be modified to check for that interface for similarity.
But it's probably more practical to just create a subclass of your Similarity that hard-codes the values, and then refer to that in the schema.xml (since there is only going to be one Similarity in the system).
-Yonik
Grant Ingersoll 2007-12-28, 21:49
On Dec 28, 2007, at 4:17 PM, Yonik Seeley wrote:
> On Dec 28, 2007 4:05 PM, Grant Ingersoll <[EMAIL PROTECTED]> wrote: >> I have a custom Similarity class that I would like to load. It has a >> no-arg constructor, so it should work fine within Solr's context. >> However, it has the option for other constructor input values as well >> that I would like to be able to set. Is there a way to set these >> values in Solr via the schema.xml declaration? In looking at >> IndexSchema.java, it seems like it is not supported, but I was >> wondering if I was missing something. > > One option for a custom similarity is to have it implement the > NamedListInitializedPlugin interface. > Solr would have to be modified to check for that interface for > similarity. > > But it's probably more practical to just create a subclass of your > Similarity that hard-codes the values, and then refer to that in the > schema.xml (since there is only going to be one Similarity in the > system).
Right, but that means recompiling every time I want to test different parameters. I'll take a look at the NamedList stuff at some point soon.
-Grant
|
|