Search keyword not working properly

Tagged:
  • wpsolr
    Keymaster
    1 year, 7 months ago #30341

    File /plugins/wpsolr-pro/wpsolr/core/classes/engines/solarium/class-wpsolr-solariumclient.php, line 30:
    return new WPSOLR_ResultsSolariumClient( $search_engine_client->execute( $update_query ) );

    $search_engine_client is the Solarium library client.
    $search_engine_client->execute( $update_query ) executes the update query within the Solarium library.

    You can try to debug step by step, until you find the cURL’s call to your Solr server.

    hsurekar
    Participant
    1 year, 7 months ago #30344

    Ok i have attached file please check and let me know what need to change.
    https://drive.google.com/file/d/166pfuXOgaLjpZGOLm3XBt7TSDJQF_QzX/view?usp=sharing

    Thanks

    wpsolr
    Keymaster
    1 year, 7 months ago #30345

    In this file, it is too late to modify the data. It was meant to spy the call to Solr.
    If you want to test some data cleaning, you can use WPSOLR hooks in your them’s functions.php:

    use wpsolr\core\classes\WPSOLR_Events;
    use wpsolr\core\classes\WpSolrSchema;
    
    add_action( 'after_setup_theme', function () {
        add_filter( WPSOLR_Events::WPSOLR_FILTER_SOLARIUM_DOCUMENT_FOR_UPDATE, 'wpsolr_filter_solarium_document_for_update', 10, 5 );
    } );
    
    /**
    *
     * @param array $document_for_update
     * @param $solr_indexing_options
     * @param $post
     * @param $attachment_body
     * @param WPSOLR_AbstractIndexClient $search_engine_client
     *
     * @return array Document updated with fields
     */
    function wpsolr_filter_solarium_document_for_update( array $document_for_update, $solr_indexing_options, $post, $attachment_body, WPSOLR_AbstractIndexClient $search_engine_client ) {
    
     /** Clean $document_for_update fields required **/
     $document_for_update[ 'title' ] = ...;
     $document_for_update[ 'title_s' ] = ...;
     $document_for_update[ 'content' ] = ...;
       
     return $document_for_update;
    }
    • This reply was modified 1 year, 7 months ago by wpsolr.
    hsurekar
    Participant
    1 year, 7 months ago #30347

    I have added above code in theme’s function.php file but I am getting below error

    `PHP Fatal error: Uncaught TypeError: Argument 5 passed to wpsolr_filter_solarium_document_for_update() must be an instance of WPSOLR_AbstractIndexClient, instance of wpsolr\\core\\classes\\engines\\solarium\\WPSOLR_IndexSolariumClient given, called in /nas/content/live/malwstage/wp-includes/class-wp-hook.php on line 307 and defined in /nas/content/live/malwstage/wp-content/themes/jarida/functions.php:297\nStack trace:\n#0 /nas/content/live/malwstage/wp-includes/class-wp-hook.php(307): wpsolr_filter_solarium_document_for_update(Array, Array, Object(WP_Post), ”, Object(wpsolr\\core\\classes\\engines\\solarium\\WPSOLR_IndexSolariumClient))\n#1 /nas/content/live/malwstage/wp-includes/plugin.php(189): WP_Hook->apply_filters(Array, Array)\n#2 /nas/content/live/malwstage/wp-content/plugins/wpsolr-pro/wpsolr/core/classes/models/class-wpsolr-model-abstract.php(84): apply_filters(‘wpsolr_filter_s…’, Array, Array, Object(WP_Post), ”, Object(wpsolr\\core\\classes\\engines\\solarium\\WPSOLR_IndexSolariumClient))\n#3 /nas/content/live/malwstage/wp-content in /nas/content/live/malwstage/wp-content/themes/jarida/functions.php on line 297, referer: https://malwstage.wpengine.com/wp-admin/admin.php?page=solr_settings&tab=solr_operations

    wpsolr
    Keymaster
    1 year, 7 months ago #30348

    In your fifth parameter, remove the type WPSOLR_AbstractIndexClient:
    function wpsolr_filter_solarium_document_for_update( array $document_for_update, $solr_indexing_options, $post, $attachment_body, $search_engine_client ) {..}

    instead of:
    function wpsolr_filter_solarium_document_for_update( array $document_for_update, $solr_indexing_options, $post, $attachment_body, WPSOLR_AbstractIndexClient $search_engine_client ) {...}

    hsurekar
    Participant
    1 year, 7 months ago #30352

    ok I tried but still i am facing issue with below error.

    An error or timeout occured.

    Error code: parsererror

    Error message: SyntaxError: Unexpected token P in JSON at position 0

    Posts excluded from the index:<br><b></b><br><br>******** DEBUG ACTIVATED – Beginning of new loop (batch size) *******<br><br>******** DEBUG ACTIVATED – Query documents from last post date *******<br><br>Query:<br><b>SELECT ID, post_modified, post_parent, post_type FROM wp_1_posts AS A WHERE ((post_modified = ‘2010-12-02 19:10:38’ AND ID > 97533) OR (post_modified > ‘2010-12-02 19:10:38’)) AND ( post_status IN (‘publish’) AND ( post_type = ‘post’ ) ) ORDER BY post_modified ASC, ID ASC LIMIT 1</b><br><br>Last post date:<br><b>2010-12-02 19:10:38</b><br><br>Last post ID:<br><b>97533</b><br><br>Post to be sent:<br><b>{ “id”: “97539”, “PID”: “97539”, “type”: “post”, “meta_type_s”: “post_type”, “displaymodified”: “2010-12-02T19:16:50Z”, “title”: “AmeriCorps program paying dividends”, “title_s”: “AmeriCorps program paying dividends”, “permalink”: “https:\/\/malwstage.wpengine.com\/2010\/12\/02\/americorps-program-paying-dividends\/”, “post_status_s”: “publish”, “content”: “To the editor:\r\n\r\nWe at South Coastal Counties Legal Services Inc. applaud your Nov. 22 editorial, \”Legal Corps program model worth copying,\” and we would like to call your attention to the Massachusetts Legal Assistance for Self-Sufficiency AmeriCorps Program, or MLASSP.\r\n\r\nThe AmeriCorps program is designed to assist and support the network of legal services organizations serving low-income populations across the state. It is hosted by SCCLS, with AmeriCorps funding provided by the Corporation for National and Community Service, and administered by the Massachusetts Service Alliance.\r\n\r\nIn June, MLASSP was recognized at the National Conference on Volunteerism and Service in New York City as one of the most innovative new AmeriCorps programs in the past five years.\r\n\r\nSince the fall of 2005, MLASSP has placed more than 150 law school and college graduates at non-profit law firms, providing a meaningful opportunity for new lawyers and pre-professionals to develop their skills and experience in legal services programs while giving back to the community.\r\n\r\nNine of the current AmeriCorps members are attorneys, most of whom are newly bar-certified, and many of the volunteer advocates possess much-needed language skills, enabling them to create bridges to the diverse communities they serve.\r\n\r\nThe addition of 28 AmeriCorps legal advocates to 18 partner legal services organizations and other nonprofits each year increases the number of low-income individuals who have access to justice in critical matters, thus stabilizing their families and households.\r\n\r\nRichard McMahon\r\n\r\nKathleen Marx\r\n\r\nFall River\r\n\r\nRichard McMahon is executive director and Kathleen Marx volunteer coordinator of South Coastal Counties Legal Services Inc.”, “snippet_s”: “To the editor:\r\n\r\nWe at South Coastal Counties Legal Services Inc. applaud your Nov. 22 editorial, ?”, “post_author_s”: “1”, “author”: “admin”, “menu_order_i”: 0, “PID_i”: “97539”, “author_s”: “https:\/\/malwstage.wpengine.com\/author\/admin\/”, “displaydate”: “2010-12-02T19:16:50Z”, “displaydate_dt”: “2010-12-02T19:16:50Z”, “date”: “2010-12-03T00:16:50Z”, “displaymodified_dt”: “2010-12-02T19:16:50Z”, “modified”: “2010-12-03T00:16:50Z”, “displaymodified_dt_i”: “1291317410000”, “displaymodified_dt_y_i”: “2010”, “displaymodified_dt_ym_i”: “12”, “displaymodified_dt_yw_i”: “48”, “displaymodified_dt_yd_i”: “336”, “displaymodified_dt_md_i”: “2”, “displaymodified_dt_wd_i”: “5”, “displaymodified_dt_dh_i”: “19”, “displaymodified_dt_dm_i”: “16”, “displaymodified_dt_ds_i”: “50”, “displaydate_dt_i”: “1291317410000”, “displaydate_dt_y_i”: “2010”, “displaydate_dt_ym_i”: “12”, “displaydate_dt_yw_i”: “48”, “displaydate_dt_yd_i”: “336”, “displaydate_dt_md_i”: “2”, “displaydate_dt_wd_i”: “5”, “displaydate_dt_dh_i”: “19”, “displaydate_dt_dm_i”: “16”, “displaydate_dt_ds_i”: “50”, “date_i”: “1291335410000”, “date_y_i”: “2010”, “date_ym_i”: “12”, “date_yw_i”: “48”, “date_yd_i”: “337”, “date_md_i”: “3”, “date_wd_i”: “6”, “date_dh_i”: 0, “date_dm_i”: “16”, “date_ds_i”: “50”, “displaydate_i”: “1291317410000”, “displaydate_y_i”: “2010”, “displaydate_ym_i”: “12”, “displaydate_yw_i”: “48”, “displaydate_yd_i”: “336”, “displaydate_md_i”: “2”, “displaydate_wd_i”: “5”, “displaydate_dh_i”: “19”, “displaydate_dm_i”: “16”, “displaydate_ds_i”: “50”, “modified_i”: “1291335410000”, “modified_y_i”: “2010”, “modified_ym_i”: “12”, “modified_yw_i”: “48”, “modified_yd_i”: “337”, “modified_md_i”: “3”, “modified_wd_i”: “6”, “modified_dh_i”: 0, “modified_dm_i”: “16”, “modified_ds_i”: “50”, “comments”: [], “numcomments”: 0, “categories_str”: [ “Letters” ], “categories”: [ “Letters”, “MALW”, “Subscriber Only”, “No” ], “flat_hierarchy_categories_str”: [ “Letters” ], “non_flat_hierarchy_categories_str”: [ “Letters” ], “tags”: [ “Dec. 6 2010 issue.” ], “dmcss_pub_code_str”: [ “MALW” ], “dmcss_security_policy_str”: [ “Subscriber Only” ], “we_own_it_str”: [ “No” ] }</b><br><br>{“nb_results”:0,”status”:400,”message”:”Solr HTTP error: Bad Request (400)\n{\n "responseHeader":{\n "status":400,\n "QTime":0},\n "error":{\n "metadata":[\n "error-class","org.apache.solr.common.SolrException",\n "root-error-class","java.io.CharConversionException"],\n "msg":"Invalid UTF-8 middle byte 0x3c (at char #2395, byte #127)",\n "code":400}}\n”,”indexing_complete”:false}

    wpsolr
    Keymaster
    1 year, 7 months ago #30353

    This is a file format issue, often due to XML (generated from a PDF for instance) containing the forbidden “<" character. No obvious solution, appart from removing the documents or fixing the documents content: https://www.wpsolr.com/forums/topic/indexing-error-invalid-utf-8-middle-byte-0x3c/

    Back to square one It seems.

    hsurekar
    Participant
    1 year, 5 months ago #30868

    Hi
    If i am using this symbol § it’s not indexing and giving error invalid-utf-8-middle-byte-0x3c and i want to use this symbol how can i use it without any error?

    Thanks

    wpsolr
    Keymaster
    1 year, 5 months ago #30874

    I also indexed a post with § in Solr, with success.

Viewing 9 posts - 106 through 114 (of 114 total)

You must be logged in to reply to this topic.