Forum Replies Created
-
wpsolrKeymaster7 years, 10 months ago in reply to: Filter the search results by taxonomy #8655
If you send me your code, I’ll add it to the documentation.
wpsolrKeymaster7 years, 10 months ago in reply to: Filter the search results by taxonomy #8653Have a look at the very end of : /guide-category/actions-and-filters/
wpsolrKeymaster7 years, 10 months ago in reply to: Filter the search results by taxonomy #8651Can I see your code?
wpsolrKeymaster7 years, 10 months ago in reply to: Filter the search results by taxonomy #8649Also check some more details in case of troubles at /guide-category/actions-and-filters/
wpsolrKeymaster7 years, 10 months ago in reply to: Filter the search results by taxonomy #8648Because you’re in a function, not in a class.
Use instead:
add_action( WPSOLR_Events::WPSOLR_ACTION_SOLARIUM_QUERY, 'wpsolr_action_query', 10, 1 );wpsolrKeymaster7 years, 10 months ago in reply to: Filter the search results by taxonomy #8646To display only posts with no value in a taxonomy field:
add_action( WPSOLR_Events::WPSOLR_ACTION_SOLARIUM_QUERY, [ $this, 'wpsolr_action_query', ], 10, 1 ); /** * * Add a "not exists" filter on a taxonomy. * * @param array $parameters * */ public function wpsolr_action_query( $parameters ) { $taxonomy_name = 'my-taxonomy'; /* @var WPSOLR_AbstractSearchClient $search_engine_client */ $search_engine_client = $parameters[ WPSOLR_Events::WPSOLR_ACTION_SOLARIUM_QUERY__PARAM_SOLARIUM_CLIENT ]; /** * Create a "not exists" filter */ $filter_not_exists_terms_in_taxonomy = $search_engine_client->search_engine_client_create_not( $search_engine_client->search_engine_client_create_filter_exists( $taxonomy_name . WpSolrSchema::_SOLR_DYNAMIC_TYPE_STRING ) ); $search_engine_client->search_engine_client_add_filter( "not in taxonomy {$taxonomy_name}", $filter_not_exists_terms_in_taxonomy ); }wpsolrKeymaster7 years, 10 months ago in reply to: Filter the search results by taxonomy #8645You mean to filter out posts with no term in the taxonomy?
wpsolrKeymaster7 years, 10 months ago in reply to: Filter the search results by taxonomy #8643Then it’s simple.
To know which parameters to use, just configure your taxonomy as a facet in screen 2.4.
The taxonomy then appears in the facets widget. Click on a taxonomy, and observe the url. This is your parameter.
wpsolrKeymaster7 years, 10 months ago in reply to: Filter the search results by taxonomy #8641Hi,
Will you pass the taxonomy in the url parameters ?
wpsolrKeymaster7 years, 10 months ago in reply to: Suggestions box size #8639You just need to replace your search bar with the Yith search bar.
wpsolrKeymaster7 years, 10 months ago in reply to: Suggestions box size #8636Hi,
You have 2 options:
– a bit of css
– or activate the WPSOLR’s Yith Ajax search extension. It will replace the suggestions UI.wpsolrKeymaster7 years, 10 months ago in reply to: Display order of default results that takes into account several criteria #8634The second sort only works if the first has few distinct values. For example the post type.
So, if the first sort is the relevance (ie score), its value is a distinct real for almost all the results. The second sort is then useless.
wpsolrKeymaster7 years, 10 months ago in reply to: Display order of default results that takes into account several criteria #8632Hello,
In the WPSOLR 21.0 version there is a definable second sort (in screen 2.5)
Otherwise, the extension “Advanced scoring” makes it possible precisely to define finer scoring with a notion of time “Decay”. But it only works with Elasticsearch.
wpsolrKeymaster7 years, 10 months ago in reply to: Reintalling WPSOLR after switching to a new hosting service #8628You can activate it on your current license. I added an extra dev/test seat for that.
wpsolrKeymaster7 years, 10 months ago in reply to: Reintalling WPSOLR after switching to a new hosting service #8626You need PHP 5.6.5