Is it possible to get clustering in Solr querying via SolrNet? using built-in algos. like Carrot2 etc.? Can anyone share some sample code or tips to proceed?
+1
A:
No, Solr clustering is not currently implemented in SolrNet. It doesn't seem to be hard to implement though. Here's an outline of what it would take:
- Model the Solr response for clusters as a class (e.g.
ClusteringResult
). For example, StatsResult models the response for the StatsComponent. - Add a property for
ClusteringResult
inISolrQueryResults<T>
andSolrQueryResults<T>
- Implement a
ISolrResponseParser<T>
to parse the part of Solr XML response with the clustering information and load aClusteringResult
object. See other response parsers for reference. - Register the response parser in the built-in container, the Ninject module, the Windsor facility and the StructureMap registry.
- Model the parameters involved in the query as a class (e.g.
ClusteringParameters
). This would include a property to mirror carrot.algorithm, another for carrot.url, etc. - Add a property for
ClusteringParameters
inQueryOptions
. - Serialize this
ClusteringParameters
to querystring parameters inSolrQueryExecuter
.
And of course, unit tests for everything. Ideally, also an integration test.
Then send me a pull request ;-)
Mauricio Scheffer
2010-09-15 17:01:52
just registered an enhancement request about this: http://code.google.com/p/solrnet/issues/detail?id=121
Mauricio Scheffer
2010-09-15 17:05:41
@Mauricio - Thanks much. Will try and help where I can and add my 2c to your excellent effort.
Mikos
2010-09-16 12:38:48