ColdFusion Verity Search Float Problem
I have a database full of products. One of the fields for each product in the database is a minimum price. I'm trying to create a search that says something like "find all products with a minimum price between X and Y." However, when it returns results, it includes numbers that are out of the range. For instance, if I say between 2 and 3 dollars, it will return the correct results but will include numbers like 25.00 and 245.00, and when I do something like "between 4 and 5 dollars" it returns the correct results with additional numbers like "40.00" and "434.00." So it seems to me that ColdFusion can't process the floating number correctly...It sees a number like "40.00" and assumes its in the range between 4 and 5. Here is my code for the indexing:
<cfquery name="v_qryProductInfo" datasource="#application.DSN#">
SELECT DISTINCT SP.pk_storeProductID,
P.productName,
C.categoryName,
P.prodTimeMin,
P.prodTimeMax,
PD.miniDesc,
PD.keywords,
CONVERT(float, (dbo.getMinPrice(pk_storeProductID))) AS minPrice
FROM tblProduct P
INNER JOIN tblProductDescription PD ON P.pk_productID = PD.fk_productID
INNER JOIN tblStoreProduct SP ON P.pk_productID = SP.fk_productID
INNER JOIN tblProductSubCategory PSC ON SP.pk_storeProductID = PSC.fk_productID
INNER JOIN tblSubCategory SC ON SC.pk_subCategoryID = PSC.fk_subCategoryID
INNER JOIN tblCategory C ON C.pk_categoryID = SC.fk_categoryID
WHERE (SP.blnStoreActive = 1)
AND (SP.fk_storeID = #application.storeID#)
</cfquery>
<cfdump var="#v_qryProductInfo#">
<h1>Indexing data...</h1>
<cfindex
action="refresh"
collection="#application.vcCollection#"
key="pk_storeProductID"
type="custom"
title="productName"
query="v_qryProductInfo"
body="miniDesc, keywords, pk_storeProductID, minPrice"
Custom1="minPrice"
Custom2="prodTimeMin"
Custom3="prodTimeMax"
Custom4="categoryName"
>
My cfsearch tag criteria looks like this:
<cfsearch
criteria="CF_CUSTOM1 >= #priceRangeMin# <AND> CF_CUSTOM1 <= #priceRangeMax#"
name="qryFoundProducts"
collection="#application.vcCollection#">
I've made the Custom1 column for the indexing the "minPrice" which is calculated as a function in my database. I've even tried making sure the number that is being entered in the Custom1 index is a float by using the CONVERT function in my SQL code. Any ideas why ColdFusion can't properly relate a float? It seems like it's trying to compare a string and a float, which isn't working too well.
Any info would be greatly apprecaited.
