solr OR fq not working
-
leninsuarezParticipant4 years, 1 month ago #13816
Hello!
I’m trying to query some posts using an OR filter
type:resources OR is_resource_str:1
If I use that single query in the solr dashboard I get the desired results,
however I’m unable to set those parameters via php array or query stringI’ve tried these options
‘wpsolr_fq[]’ => ‘type:resources||is_resource_str:1’,
‘wpsolr_fq’ => ‘type:resources||is_resource_str:1’,
‘wpsolr_fq’ => ‘type:resources OR is_resource_str:1’,Can you point me in the direction to achieve this?
Thanks
leninsuarezParticipant4 years ago #13910Thanks for your answer, i was able to add this OR filter using the wpsolr_action_solarium_query hook, and then calling addFilterQuery function.
Now my problem has gone to another direction, I have multiple searches running in the same page (planning to move to a grouped query if available), this is the steps I’m following to do this
* I’m manually setting the value of $_SERVER[‘QUERY_STRING’] with the propper http query
* I’m calling doing what the fun_search_indexed_data() function does in ajax_solr_services.php
$_q = WPSOLR_Service_Container::get_query();
$this->search_results = WPSOLR_Service_Container::get_solr_client()->get_results_data($_q);I also changed the class-wpsolr-abstractsearchclient.php file to disable cache for multiple searches running on the same page
line 893 –> $results = $this->execute_wpsolr_query( $wpsolr_query, false );
Using a solr instance this works just fine, but when I change to an AWS elasticsearch instance, my custom search breaks, I got results but query filters are not working.
Do I need to do something else that I’m missing? Thanks!
wpsolrKeymaster4 years ago #13911Be aware that the code you use is internal, and subject to change.
Using a solr instance this works just fine, but when I change to an AWS elasticsearch instance, my custom search breaks, I got results but query filters are not working.
It means the code detected a problem, and reverted to the standard WP search. Try to check your debug.log for errors.
You must be logged in to reply to this topic.