Closed (fixed)
Project:
CCK Facets
Version:
6.x-1.x-dev
Component:
Number Facets
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Mar 2009 at 12:31 UTC
Updated:
15 May 2009 at 19:20 UTC
Jump to comment: Most recent file
Comments
Comment #1
restyler commentedThe error can be reproduced only when you search by 'off' value of checkbox (For example I have a cck field 'kid friendly', it's a number single on/off checkbox). One node has this checkbox on, and one node has this checkbox off. So when you click on
Kid friendly (1) on search page - it works ok, but if you click on Kid friendly Off (1) - you get the error.
Comment #2
junedkazi commentedHi,
I also came across this same issue. Here are the things which I noticed.
Here are my observations:
For a radio button number field the allowed values are as follows:
0|No
1|Yes
1 - When it comes into
function number_facets_cck_facets_collect(&$facets, $field, $domain, $env, $arg = NULL)in case "text" the if condition
if ($number = search_query_extract($arg, $field['field_name']))breaks downbecause if $number is 0 is case of the No(0) case it won't enter the if condition which breaks down the search first.
So I changed the if condition as follows to debug it a bit further
if (is_numeric($number = search_query_extract($arg, $field['field_name'])))so that it enters the if condition.
Once it enters the if condition it breaks down again at this point
$arg = search_query_insert($arg, $field['field_name']);so on checking the search module I noticed that it checks for
if (search_query_extract($keys, $option))This again will break it down bcoz in case of the No(0) case the function
search_query_extract($keys, $option) will return a 0.
so if(0) will always fail .
I am still trying to figure a way out of this situation.
Comment #3
David Lesieur commentedMarked #450642: CCK Facets returns empty result set for “0” (zero) selection as duplicate.
Comment #4
David Lesieur commentedComment #5
David Lesieur commentedI have committed the patch below to the Number Facets module, but you'll also need to apply the patch from #419388: search_query_insert breaks down when the value of key is 0 to get the problem solved.