繁体   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