• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Coldfusion CFSearch question

Hi Guys,

I'm working on a search engine for my site. I already have a catalog/index built. CFsearch works fine if I just use keywords in the "criteria" field.

In the index, I have custom3 set to equal the zip code. So if someone enters a zip code of 63101 within 5 miles, and it returns 7 zip codes, I want to search where custom3 is equal to any one of those zip codes. I have a working function that gets those zip codes.

I have it so users can enter in search criteria in a form, as well as include a zip code range finder.

Search_Box (key words)
Zip_Code
Range (5 miles, 10 miles, 15 miles, etc)

I already have the function working that finds zip codes within a certain range, and my guess is I need to have those results compiled into an array. Let's assume those results are put into variable "zip_array"

I'm hoping I can isolate the records that max the zipcode/custom3 field from the first search, rather than having to do a broader search, then do another query on those results.


Would something like this work?

<CFSEARCH NAME="Search" COLLECTION="#collection#" type="simple" criteria="see below">

criteria="#form.searchbox# AND custom3="#zip_array#"


Or how about this?


<CFSEARCH NAME="Search" COLLECTION="#collection#" custom3="zip_array" type="simple" criteria="#form.searchbox#">

If I can't get it to work in one search, I guess I will just do two queries. If anybody can point in the right direction I'd greatly appreciate it.

-Jason
 
Ok, In messing with syntax, I got the following to work exactly as I need.

criteria="#form.search_box# AND (custom3:63101 or custom3:62208)"

Now I need to figure out how to best dynamically create (custom3:63101 or custom3:62208) so that if needed it will look like

(custom3:63101 or custom3:62209 or custom3:62208 or custom3:62238 or custom3:62218 or custom3:62225 or custom3:62249)"
 
Back
Top