小编mst*_*std的帖子

多字段搜索的Elasticsearch语法错误

我观看了Itamar Syn Hershko的Elasticsearch Do's,Don'ts和Pro-Tips

https://www.youtube.com/watch?v=c9O5_a50aOQ

我在下图中的几个字段中看到多个条件:

https://imgur.com/a/17zAZ4w

我尝试在我的Laravel 5.7应用程序(使用elasticsearch/elasticsearch插件)中创建它,如下面的代码所示:

$elasticQuery = [
    "bool" => [
        'must'   => [
            'multi_match' => [
                'query'  => $text,
                'fields' => ['name^4', 'description']
            ],
        ],
        "should" => [
            'term' => [
                "category_id" => 1,
            ]
        ]
    ]
];
Run Code Online (Sandbox Code Playgroud)

但是我得到了错误:

{"error":{"root_cause":[{"type":"parsing_exception","reason":"[bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":130}],"type":"parsing_exception","reason":"[bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":130},"status":400}
Run Code Online (Sandbox Code Playgroud)

但是当我使用一个简单的条件时:

        $elasticQuery = [
            'multi_match' => [
                'query' => $text,
                'fields' => ['name^4', 'description'],
            ],
        ];
Run Code Online (Sandbox Code Playgroud)

我得到了一个有效的结果:

[hits] => Array …
Run Code Online (Sandbox Code Playgroud)

elasticsearch laravel-5

9
推荐指数
1
解决办法
191
查看次数

如何使用站点密钥修复NoCaptcha错误?

在我的laravel 5.7.3应用程序中,我使用https://github.com/anhskohbo/no-captcha 为此,我安装了此软件包,并将refs添加到config/app.php文件中.之后,我通过链接和我的谷歌帐户,我有下一个帐户:https: //imgur.com/a/leBrPOt

但是在我的刀片模板中插入下一行:

    <div class="form-row mb-3">
        {!! NoCaptcha::renderJs() !!}
    </div>
Run Code Online (Sandbox Code Playgroud)

在我的.env文件中我添加了一行:

NOCAPTCHA_SECRET=6LcRPHEUAAAAAKXPSZt0Hjjibxa1p_iq6XbH6sFk
NOCAPTCHA_SITEKEY=6LcRPHEUAAAAAPx8iLqBT1bThH1XfIhdcDYs-ssU
Run Code Online (Sandbox Code Playgroud)

因为我看到我输入了有效的NoCapture参数并发布了配置文件.用命令清除cach之后:

php artisan cache:clear
php artisan config:cache
Run Code Online (Sandbox Code Playgroud)

但在我的表单上,我看到图像重新捕获块有错误:

ERROR for site owner: Invalid site key
Run Code Online (Sandbox Code Playgroud)

我没有在我的控件或我的刀片模板中插入任何代码,因为它在文档中没有提到.

为什么错误?我错过了一些选择吗?

php captcha laravel-5

7
推荐指数
2
解决办法
631
查看次数

将处理消息放在具有现有数据的数据表中的表格顶部?

在我的laravel 5.7应用程序中,我使用"yajra/laravel-datatables-oracle":"~8.0"库并阅读此 https://m.datatables.net/forums/discussion/25666/how-to-customize-the-processing -信息

I modified processing message with style :
.dataTables_processing {
  margin-top: -80px !important;
  padding: 70px !important;
  background: #F5F8FA !important;
  color:    blue !important;
  border: 2px dotted darkgrey;
  border-radius: 3px !important;
  font-size: xx-large !important;
  opacity : 1 !important;
  text-decoration: none;
}
Run Code Online (Sandbox Code Playgroud)

它工作,我检查页面打开数据与空数据区域.

但我刷新数据我没有看到处理消息:它在下面(看起来像数据区域的中间).我尝试通过添加上面的样式来提高:

  vertical-align: top;
  vert-align: top;
Run Code Online (Sandbox Code Playgroud)

但失败了.

我数据区的html代码是:

<div class="table-responsive">
   <div id="get-vote-dt-listing-table_wrapper"
        class="dataTables_wrapper no-footer">
      <div id="get-vote-dt-listing-table_filter" class="dataTables_filter"
           style="display: none;"><label>Search:<input type="search" class=""
                                                       placeholder=""
                                                       aria-controls="get-vote-dt-listing-table"></label>
      </div>
      <div id="get-vote-dt-listing-table_processing"
           class="dataTables_processing" style="display: block;">Loading
         votes...
      </div>
      <table class="table table-bordered table-striped text-primary dataTable no-footer" …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery datatables

7
推荐指数
1
解决办法
462
查看次数

如何隐藏缺少的 phpmyadmin 警告?

在远程 ubuntu 18 服务器上从其中一个表中打开 phpmyadmin 中的数据时,它会显示警告和弹出窗口(例如https://imgur.com/a/b5HGGV0),这是非常缺乏的......是否有忽略/隐藏它们的方法?

服务器:通过 UNIX 套接字的本地主机服务器类型:MySQL 服务器版本:5.7.23-0ubuntu0.18.04.1 - (Ubuntu) 协议版本:10 用户:root@localhost 服务器字符集:UTF-8 Unicode (utf8)

Apache/2.4.29 (Ubuntu) 数据库客户端版本:libmysql - mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $ PHP 扩展名:mysqliDocumentation curl PHPDocumentation version: mbstring-1040ub.

phpMyAdmin 版本信息:4.6.6deb5

谢谢!

phpmyadmin

4
推荐指数
2
解决办法
4984
查看次数

时间戳更改字段上的迁移错误

在 laravel 5.7/mysql 5 应用程序中,我想将默认值设置为时间戳字段(未在创建时设置):

   $table->timestamp('created_at')->useCurrent()->change();
Run Code Online (Sandbox Code Playgroud)

但我有错误:

 Unknown column type "timestamp" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache …
Run Code Online (Sandbox Code Playgroud)

migration laravel-5

4
推荐指数
1
解决办法
2156
查看次数

为什么使用 PUT 方法提交表单我收到 GET 请求?

在我的 laravel 5.7 应用程序中,我制作了用于更新数据的表单,例如:

<section class="card-body">
    <h4 class="card-title">Edit vote</h4>


    <form method="PUT" action="{{ url('/admin/votes/update/'.$vote->id) }}" accept-charset="UTF-8" id="form_vote_edit" class="form-horizontal"
          enctype="multipart/form-data">
        {!! csrf_field() !!}
        <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
Run Code Online (Sandbox Code Playgroud)

在routes/web.php中用餐的路线:

Route::group(['middleware' => ['auth', 'isVerified', 'CheckUserStatus'], 'prefix' => 'admin', 'as' => 'admin.'], function () {
    ...
    Route::put('/votes/update/{vote_id}', 'Admin\VotesController@update');
Run Code Online (Sandbox Code Playgroud)

但提交表格时我收到错误请求:

Request URL: http://local-votes.com/admin/votes/update/22?_token=0CEQg05W4jLWtpF3xB6BGSdz1icwysiDOStLVgHv&id=22&name=gg...
Request Method: GET
Status Code: 405 Method Not Allowed
Run Code Online (Sandbox Code Playgroud)

为什么 GET 请求,我的表单有什么问题?

谢谢!

laravel-5

1
推荐指数
1
解决办法
699
查看次数