Forum Replies Created

  • pseudo visitor
    Participant

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

    Did I do well? Is there a cleaner way to do that?

    pseudo visitor
    Participant

    Yes 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 visitor
    Participant

    Ok 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 visitor
    Participant
    7 years, 11 months ago in reply to: Error saving existing index configuration #8668

    I 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 visitor
    Participant
    7 years, 11 months ago in reply to: Error saving existing index configuration #8666

    Meantime 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 visitor
    Participant
    7 years, 11 months ago in reply to: Filter the search results by taxonomy #8656

    It’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 visitor
    Participant
    7 years, 11 months ago in reply to: Filter the search results by taxonomy #8654

    Thank 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 visitor
    Participant
    7 years, 11 months ago in reply to: Filter the search results by taxonomy #8652

    Of 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 visitor
    Participant
    7 years, 11 months ago in reply to: Filter the search results by taxonomy #8650

    I now have this issue:
    Fatal error: Uncaught Error: Call to a member function search_engine_client_create_not() on null

    on 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 visitor
    Participant
    7 years, 11 months ago in reply to: Filter the search results by taxonomy #8647

    Exactly, 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 visitor
    Participant
    7 years, 11 months ago in reply to: Filter the search results by taxonomy #8644

    By 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 visitor
    Participant
    7 years, 11 months ago in reply to: Filter the search results by taxonomy #8642

    Exactly ????

    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 visitor
    Participant
    7 years, 11 months ago in reply to: Suggestions box size #8638

    My 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 visitor
    Participant

    I 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 visitor
    Participant

    Ok. Just for testing purpose, can you give us a temporary license?

Viewing 15 posts - 121 through 135 (of 200 total)