Skip to content

Apache Lucene open-source search software

SOLR-2178: Hook in Carrot2 clustering to /browse

Grant Ingersoll0f52c2de169e
diff --git a/solr/example/solr/conf/solrconfig.xml b/solr/example/solr/conf/solrconfig.xml
index f934c6df70b..a8cfc37e102 100755
--- a/solr/example/solr/conf/solrconfig.xml
+++ b/solr/example/solr/conf/solrconfig.xml
@@ -871,6 +871,14 @@
<!--<int name="carrot.numDescriptions">5</int>-->
<!-- produce sub clusters -->
<bool name="carrot.outputSubClusters">false</bool>
+
+ <str name="defType">edismax</str>
+ <str name="qf">
+ text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
+ </str>
+ <str name="q.alt">*:*</str>
+ <str name="rows">10</str>
+ <str name="fl">*,score</str>
</lst>
<arr name="last-components">
<str>clusteringComponent</str>
diff --git a/solr/example/solr/conf/velocity/cluster.vm b/solr/example/solr/conf/velocity/cluster.vm
new file mode 100644
index 00000000000..ab2f0e458eb
--- /dev/null
+++ b/solr/example/solr/conf/velocity/cluster.vm
@@ -0,0 +1,9 @@
+<h2 #annTitle("Clusters generated by Carrot2 using the /clustering RequestHandler")>Clusters</h2>
+<div id="clusters">
+ Run Solr with java -Dsolr.clustering.enabled=true -jar start.jar to see results
+</div>
+<script type="text/javascript">
+
+ $('#clusters').load("#url_for_solr/clustering#lens",
+ {'wt':'velocity', 'v.template':"clusterResults"});
+</script>
diff --git a/solr/example/solr/conf/velocity/clusterResults.vm b/solr/example/solr/conf/velocity/clusterResults.vm
new file mode 100644
index 00000000000..db1774d4498
--- /dev/null
+++ b/solr/example/solr/conf/velocity/clusterResults.vm
@@ -0,0 +1,12 @@
+#foreach ($clusters in $response.response.clusters)
+ #set($labels = $clusters.get('labels'))
+ #set($docs = $clusters.get('docs'))
+ <h3>#foreach ($label in $labels)$label#if( $foreach.hasNext ),#end#end</h3>
+ <ol>
+ #foreach ($cluDoc in $docs)
+ <li><a href="#url_for_home?q=id:$cluDoc">$cluDoc</a></li>
+ #end
+ </ol>
+
+
+#end
\ No newline at end of file
diff --git a/solr/example/solr/conf/velocity/facets.vm b/solr/example/solr/conf/velocity/facets.vm
index cba4bf7b841..4dfde9ed2d5 100644
--- a/solr/example/solr/conf/velocity/facets.vm
+++ b/solr/example/solr/conf/velocity/facets.vm
@@ -3,6 +3,7 @@
#parse('facet_ranges.vm')
#parse('facet_dates.vm')
#parse('facet_pivot.vm')
+#parse('cluster.vm')