Forum Replies Created
-
pseudo visitorParticipant7 years, 11 months ago in reply to: Building a custom facet from an ACF post type relationship #8677
I probably misunderstood something but I can not
recover my custom field relationship because in tab 2.2, it is not
not in the fields that can be checked to index.To lift the restriction you have to put on the fields of
relationship type, I added the const corresponding to the types of ACF (by
ex: “self::ACF_FIELD_TYPE_RELATIONSHIP_POST_OBJECT,”) in the table
$indexable_acf_fields from class-wpsolr-plugin-acf.phpDid I do well? Is there a cleaner way to do that?
pseudo visitorParticipant7 years, 11 months ago in reply to: Building a custom facet from an ACF post type relationship #8674Yes great, I was looking at what you had done for directory2, it’s in the same vein.
Thank you very much for the details!You have just updated the doc at the same time, no? Before I refreshed I had WpSolrFilters::WPSOLR_FILTER_POST_CUSTOM_FIELDS instead of WPSOLR_Events::WPSOLR_FILTER_POST_CUSTOM_FIELDS.
pseudo visitorParticipant7 years, 11 months ago in reply to: Building a custom facet from an ACF post type relationship #8672Ok yes I understand you, the only case I had was very specific and a little far fetched: we needed to create a custom post type Author (different from the native WP Users because they did not have the possibility of connecting to the BO, it was authors in the literary sense / journalist of the term).
In our Articles, we had a relationship to 0..n Authors. In our research, it was obviously necessary to filter on these authors, with in this case a facet with first name + name as text. I was trying to see this use case with WPSOLR, I’ll see what I can do with your doc 🙂
nb. a priori it’s here /guide/actions-and-filters/ is that it?
pseudo visitorParticipant7 years, 11 months ago in reply to: Error saving existing index configuration #8668I did so. But there are no search results available, and the web page shows: “The search index is missing. Configure one in the Solr indexes, and select it in the default search Solr index list.”
pseudo visitorParticipant7 years, 11 months ago in reply to: Error saving existing index configuration #8666Meantime I deleted the existing index.
By trying create a new index, I received an error message:
We could not join your Solr server. Your Solr path could be malformed, or your Solr server down (Solr code 400) {"responseHeader":{"status":400,"QTime":2},"error":{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.core.SolrResourceNotFoundException"],"msg":"Error CREATEing SolrCore 'my_index': Unable to create core [my_index] Caused by: Can't find resource 'solrconfig.xml' in classpath or '/usr/home/site/solr/server/solr/configsets/my_index'","code":400}}pseudo visitorParticipant7 years, 11 months ago in reply to: Filter the search results by taxonomy #8656It’s basically the same code.
It was kinda stupid on my side, but I forgot that I was experimenting with the plugin’s hooks yesterday, so I had some spread out throughout the website. That’s why it was giving me that error I sent you. When I removed that, I just used the code I’m leaving you below in my theme’s functions.php and it worked correctly ????
use wpsolr\core\classes\WPSOLR_Events; use wpsolr\core\classes\WpSolrSchema; add_action(WPSOLR_Events::WPSOLR_ACTION_SOLARIUM_QUERY, 'wpsolr_action_query', 10, 1); function wpsolr_action_query($parameters) { /* @var WPSOLR_AbstractSearchClient $search_engine_client */ $search_engine_client = $parameters[WPSOLR_Events::WPSOLR_ACTION_SOLARIUM_QUERY__PARAM_SOLARIUM_CLIENT]; $taxonomy_name = 'tax-name'; /** * 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); }And again, thanks a lot for your help!
pseudo visitorParticipant7 years, 11 months ago in reply to: Filter the search results by taxonomy #8654Thank you, I was able to make it work finally ????
I also figured out that to have the same effect on several taxonomies I just have to repeat the process for each one ????Again, thank you for everything and for your patience.
pseudo visitorParticipant7 years, 11 months ago in reply to: Filter the search results by taxonomy #8652Of course.
Inside my functions.php I’m doing the following:
use wpsolr\core\classes\WPSOLR_Events; use Solarium\QueryType\Select\Query\FilterQuery; use Solarium\QueryType\Select\Query\Query; use wpsolr\core\classes\engines\solarium\admin\WPSOLR_Solr_Admin_Api_Core; use wpsolr\core\classes\engines\WPSOLR_AbstractSearchClient; use wpsolr\core\classes\hosting_api\WPSOLR_Hosting_Api_Abstract; use wpsolr\core\classes\services\WPSOLR_Service_Container; use wpsolr\core\classes\utilities\WPSOLR_Regexp; use wpsolr\core\classes\WpSolrSchema; add_action(WPSOLR_Events::WPSOLR_ACTION_SOLARIUM_QUERY, 'wpsolr_action_query', 10, 1); function wpsolr_action_query($parameters) { $taxonomy_name = 'tax1'; /* @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); }pseudo visitorParticipant7 years, 11 months ago in reply to: Filter the search results by taxonomy #8650I now have this issue:
Fatal error: Uncaught Error: Call to a member function search_engine_client_create_not() on nullon the following line:
$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));pseudo visitorParticipant7 years, 11 months ago in reply to: Filter the search results by taxonomy #8647Exactly, that’s it ????
Where should I insert this code? When I do it in my theme’s functions.php, I get the following error:
Fatal error: Uncaught Error: Using $this when not in object context in …
Where does “$this” come from?pseudo visitorParticipant7 years, 11 months ago in reply to: Filter the search results by taxonomy #8644By doing that, it only allows me to filter by a term inside this taxonomy. Is there a way to show the posts and terms only for the desired taxonomy?
For example: by passing “?tax=tax1” it only shows the terms and posts for that taxonomy.
pseudo visitorParticipant7 years, 11 months ago in reply to: Filter the search results by taxonomy #8642Exactly ????
I was using the “pre_get_posts” hook before to filter the search results, but since using WPSOLR, it isn’t working anymore.
Here you have an example of what the URL will look like: https://www.testwebsite.com/?s=tste&tax=com-usar
pseudo visitorParticipant7 years, 11 months ago in reply to: Suggestions box size #8638My woocommerce theme is Electro: https://themeforest.net/item/electro-electronics-store-woocommerce-theme/15720624
If you want I can send you a copy of the theme for local testing. Or create a temporary admin account on the live site.
pseudo visitorParticipant7 years, 11 months ago in reply to: Display order of default results that takes into account several criteria #8633I tried to use this option but it has no impact on the display order. (The second option selected, “Newest” does not seem to be taken into account)
pseudo visitorParticipant7 years, 11 months ago in reply to: Reintalling WPSOLR after switching to a new hosting service #8627Ok. Just for testing purpose, can you give us a temporary license?