Download & Extend

Empty result set when search key value is 0

Project:CCK Facets
Version:6.x-1.x-dev
Component:Number Facets
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Have anyone tried that?
When I try to refine by one field, I get 'no results' and strange output in 'current search' block. Check the screenshot

AttachmentSize
facet_cck.jpg147.48 KB

Comments

#1

The 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.

#2

Priority:normal» critical

Hi,

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 down
because 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.

#3

#4

Title:error when trying to refine by cck field (integer, single on/off checkbox)» Empty result set when search key value is 0

#5

Status:active» fixed

I 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.

AttachmentSize
number-facets-zero-value.patch 896 bytes

#6

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here