Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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,
^_^
Copy link to clipboard
Copied
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:
I also tried making my custom variable lowercase as suggested here, but nothing changes: