Search Smith

ColdFusion, SQL queries, and, of course, searching

Posts Tagged ‘distributed search’

ColdFusion 9: Searching more than one Solr collection

Posted by David Faber on January 3, 2012

The <CFSEARCH> tag allows one to search multiple collections very easily, whether one is searching Verity collections or Solr:

<cfsearch name="the_search" collection="collection1,collection2,collection3,..." criteria="#the_criteria#" />

However, how does one do this when using Solr web services? We saw in a previous post that the HTTP call to the Solr web service looks like this:


We call this our “plain-vanilla” search. What if we want to search more than one “core” (Solr collection)? It doesn’t appear that we can put more than one Solr core name into the path of that HTTP call, and the last thing we want is to make multiple calls to the Solr web service. I don’t think I’ve written on the topic of paginating results with Solr, but briefly, Solr allows you to specify the start row and end row for search results by passing parameters to the web service. If multiple calls to the web service are required, then that feature is out the window if the results from multiple calls are mixed together because of sorting. (For example, if you have multiple collections partitioned by date, then sorting by score means that results from different collections will be mixed in together.)

As it turns out, we can search multiple cores by making a single call to the Solr web service. We use the shards parameter. (In fact, we can use shards to search over multiple servers!)


I recommend using a core from the shards parameter in the HTTP call itself. Truth be told, I am not certain which Solr cores can be used here!

Posted in ColdFusion, Solr | Tagged: , , , , , , , | 1 Comment »