I implementing facet search in D7 . I am dealing with big data . My search is working great but i am facing one problem . I am not able to select multiple facets in my facets and get result on seleted once . I search on this and got some thing that their is operators settings in facet api GLOBAL settings . but its not displaying in global settings. Their is no OR , AND operator in facet api. Need help on this .
Below is attched image of my settings . Please go through it will give you more idea.

Comments

danieltang’s picture

Got the same issue on a freshly installed demo site.
Related modules I've installed:
xxxxx@ubuntu:~/public_html/demo$ drush pml | grep facet
Search Search facets Module Enabled 7.x-1.4
(search_api_facetapi)
Search Facet API (facetapi) Module Enabled 7.x-1.2
Search Facet API Bonus (facetapi_bonus) Module Enabled 7.x-1.1
any ideas?
Thanks!

smashwini’s picture

Title: Operators are not get displayed in global settings of facet api » After lots of browsing i got this
Category: support » bug
Priority: Major » Critical
Status: Needs review » Active

After lot's of browsing i got this url of creating custom widget in facet API with example. http://www.trellon.com/content/blog/apachesolr-and-facetapi . I also took dive into the code of facet Api and found out that their is form of operators in that but its didnt get displayed on UI part .
Operator Form in facet.admin.inc is :-
$all_options = array(
FACETAPI_OPERATOR_AND => t('AND'),
FACETAPI_OPERATOR_OR => t('OR'),
);
$options = array_intersect_key($all_options, array_filter($facet['allowed operators']));
$form['global']['operator'] = array(
'#type' => 'radios',
'#access' => count($options) > 1,
'#title' => t('Operator'),
'#prefix' => '

',
'#suffix' => '

',
'#default_value' => $global_settings->settings['operator'],
'#options' => $options,
'#description' => t('AND filters are exclusive and narrow the result set. OR filters are inclusive and widen the result set.')
);

Any ideas on this how to show operator form on UI of facet API settings ?

cpliakas’s picture

Category: bug » support
Priority: Critical » Normal

Hi ashwiniKumar.

The facet field has to support the OR operator. I would track down the facet's definition that is defined by the backend's hook_facetapi_facet_info() implementation. You can also implement hook_facetapi_facet_info_alter() in a custom module to inspect all facet definitions and force support of the OR operator.

Thanks,
Chris

cpliakas’s picture

Title: After lots of browsing i got this » Operators are not displayed in global settings

Changing title back for clarity.

smashwini’s picture

Title: Operators are not displayed in global settings » It worked but not correct way.
Status: Active » Needs review
StatusFileSize
new878.77 KB

@cpliakas

I worked on this issue bit more and able to display operator form in facet display settings.
I have not used conventional way to solve respective problem. Probably you can give me direction on this.
I just commented below line from facetapi.admin.inc.
$options = array_intersect_key($all_options, array_filter($facet['allowed operators']));
So, instead of using array_intersect_key() and array_filter() function.
I directly gave array of operator to variable and pushed variable to operator form and it worked like charm.
$options = $all_options ;.
After that I was able to acheive functionality on which I was working on.
PFA image of output.

smashwini’s picture

Title: It worked but not correct way. » Operators are not get displayed in global settings of facet api

Changing title for more clarity.

smashwini’s picture

Title: Operators are not get displayed in global settings of facet api » Operators are not displayed in global settings
cpliakas’s picture

Status: Needs review » Postponed (maintainer needs more info)

Hi ashwiniKumar.

The concern that I have is that a facet must define which operators it supports, and the fix that is applied bypasses that logic and forces facets to support the operator even when it doesn't. If there is any info that you can provide on what the field is you are faceting on we can work through the issue in a way that doesn't brute force the issue.

Thanks for you debugging and for posting your solutions! I know there is a ton of code and getting into the internals can be daunting.
Chris

auraell’s picture

"or" is not an allowed filter for Database servers. See: https://drupal.org/node/1254698

bkline’s picture

@auraell:

Can you clarify what you mean by

"or" is not an allowed filter for Database servers.

?

Here's the table from the page whose link you supplied. It makes it look like "or" is supported for Database servers. No?

Chart of supported functionality

bkline’s picture

@cpliakas:

I see that ashwinikumar is taking a while to gather what he needs to respond to your request for additional information. How about if I step in to fill the gap while we wait for him? :-)

I'm seeing the same gap that he reported (the administrative UI doesn't expose the option to select which Boolean operator is to be used when more than one facet term is supplied). The field for the facet is content type, and the service class is DB. Is there any other information which would be useful?

Thanks,
Bob

bkline’s picture

I appears that -- although its release notes make no mention of this fact -- earlier versions of the Search API DB module did not support the OR operator, but the current version does.