Skip to main content
Participant
January 25, 2016
Question

Filter solr <cfsearch> results

  • January 25, 2016
  • 1 reply
  • 472 views

I am trying to filter search results within a solr search built in Coldfusion 10.

Apparently, the Coldfusion version of solr does not have the fq= (filter query) attribute, and I'm having trouble figuring out how to tell the search to only include records with a particular variable value.

<cfsearch name="getData" collection="MyCollection" criteria="#myCriteria# and custom1:#URL.myVariable#" maxrows="800" status="info" orderby="customvariable_s" contextBytes="80000" contextPassages="1" suggestions="always" />

I have stored a particular variable in "custom1" and want to search the collection using the criteria from a form (#myCriteria#), but only include items with the corresponding "custom1" value. Is there any way to do this?

This topic has been closed for replies.

1 reply

WolfShade
Legend
January 25, 2016

I believe that the Solr/CFSEARCH uses "+" instead of "AND", and will include "custom1:" as part of the search.

<cfsearch name="getData" collection="MyCollection" criteria="#myCriteria# + #URL.myVariable#" maxrows="800" status="info" orderby="customvariable_s" contextBytes="80000" contextPassages="1" suggestions="always" />


This _should_ work.  It's been a while since I have worked with Solr.


HTH,


^_^

Participant
January 25, 2016

Thank you for your reply. I tried using the plus sign, and while it does change the behavior of the search, it is still not working as intended. Now every search that I run returns the same 170 records. Other documentation suggests that "AND" is the correct syntax:

http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d318518-1acb57941353e8b4f85-7ff9.html

I also tried making my custom variable lowercase as suggested here, but nothing changes:

Adobe ColdFusion 10 * Search limitations