簡體   English   中英

阿爾及利亞搜索索引失敗

[英]Algolia search index fail

我已經在我的WordPress網站上安裝了Algolia搜索插件1.7.0。 我也進行了設置,當我建立索引時,將顯示以下內容:

wp_remote_post() failed, indexing won't work. Checkout the logs for more details.
URL called: http://45.77.12.19/wp-admin/admin-post.php
Array
(
    [headers] => Requests_Utility_CaseInsensitiveDictionary Object
        (
            [data:protected] => Array
                (
                    [server] => nginx/1.12.0
                    [date] => Tue, 25 Apr 2017 02:23:09 GMT
                    [content-type] => text/html
                    [content-length] => 195
                    [www-authenticate] => Basic realm="Restricted"
                )
        )

401 Authorization Required

我嘗試在wp-config.php文件中添加define('ALGOLIA_LOOPBACK_HTTP',true),然后按照說明的其他步驟進行操作:
https://community.algolia.com/wordpress/frequently-asked-questions.html

我處於死胡同,不確定由於阿爾戈利亞索引編制將不會發生,現在該怎么辦。 我該如何解決?

用於WordPress的Algolia插件需要能夠通過HTTP或HTTPS訪問管理界面。 這是它創建處理未決任務的循環的方式。

根據您的日志:'Basic realm =“ Restricted”',您的管理員似乎受到基本身份驗證(htpasswd)的保護。

為了使隊列適合您的情況,您應該為插件提供憑據。

這是您需要添加到活動主題的functions.php文件中的內容。

<?php
// In your current active theme functions.php.
define( 'MY_USERNAME', 'test' );
define( 'MY_PASSWORD', 'test' );

function custom_loopback_request_args( array $request_args ) {
    $request_args['headers']['Authorization'] = 'Basic ' . base64_encode( MY_USERNAME . ':' . MY_PASSWORD );

    return $request_args;
}

add_filter( 'algolia_loopback_request_args', 'custom_loopback_request_args' );

請注意,隨着我們努力刪除該邏輯,這可能會在接下來的幾周內改變。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM