Search Smith

ColdFusion, SQL queries, and, of course, searching

Posts Tagged ‘Solr’

ColdFusion: Running Solr on Jetty

Posted by David Faber on February 24, 2012

Lucid Imagination has a brief but helpful post on running Solr on Jetty. In ColdFusion 9, Solr runs on Jetty by default (at least under Windows – not sure about Linux or Solaris and I don’t have any information about CF 10). The jetty.xml file can be found under <CF_HOME>/solr/etc/jetty.xml. On a single-instance installation under Windows, then, it would be located under C:\ColdFusion9\solr\etc\jetty.xml.

In order to change the port on which Jetty listens, edit the following (lines 64-78 on the default CF Solr install):

<!-- Use this connector if NIO is not available. -->
<!-- This connector is currently being used for Solr because the
nio.SelectChannelConnector showed poor performance under WindowsXP
from a single client with non-persistent connections (35s vs ~3min)
to complete 10,000 requests)
-->
<Call name="addConnector">
  <Arg>
    <New class="org.mortbay.jetty.bio.SocketConnector">
      <Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
      <Set name="maxIdleTime">50000</Set>
      <Set name="lowResourceMaxIdleTime">1500</Set>
    </New>
  </Arg>
</Call>

Change the value of 8983 to a different port and then restart the ColdFusion Solr service. Solr should now be listening on a different port.

Posted in ColdFusion, Solr | Tagged: , , , | 2 Comments »

ColdFusion Solr Tutorial

Posted by David Faber on February 23, 2012

I’ve started posting a tutorial page on using ColdFusion and Solr, linked to various posts on this blog and with additional commentary.

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

ColdFusion 10 and Solr range queries

Posted by David Faber on February 20, 2012

I have not yet had a chance to install the ColdFusion 10 beta and try the new and improved CFSEARCH tag. However, this morning when looking at the Solr enhancements page for CF 10, under “Storing your custom data” I noticed the following:

Consider the following code:

<cfsearch criteria='some_criteria and column_i: [ 10 - 20 ]'...>

Here, some_criteria indicates filtering. For example column_i: [ 10 - 20 ] means search all items whose values are between 10 and 20. column_i is the custom field provided by user while indexing.

If this is truly the case, then ColdFusion is tweaking the query text before sending to Solr as Solr uses the “TO” keyword in range queries. Using a hyphen does not work in queries to the Solr web service.

Believe it or not, ColdFusion 9 does seem to include support for range queries – at least, it will not return an error when you attempt a range query on a CF-approved™ field such as custom1, custom2, etc. (I say “seems” because I’ve not been able to get CFSEARCH to return any actual data using such a query.) However, using a hyphen instead of the “TO” keyword causes an error and that error comes from Solr rather than directly from ColdFusion. So it appears that as of version 9 at least, ColdFusion does not replace the hyphen in range queries with the relevant Solr operator.

Posted in ColdFusion, Solr | Tagged: , , , , | Leave a Comment »