【问题标题】:laravel 5.2 how can i create simple search in my applicationlaravel 5.2 如何在我的应用程序中创建简单的搜索
【发布时间】:2016-04-27 19:44:28
【问题描述】:

我想在我的网站中添加搜索,例如浏览器的搜索,但是我的搜索将在我的所有应用程序中搜索并重定向到其中的页面单词。我阅读了有关弹性和 algolia 的简单信息但我想要使用简单的搜索或包.

我做了这个表格

<div class="col-sm-3">
                        <form method="GET"  action="{{url('search')}}" class="searchform">
                            <input type="text" placeholder="Search" name="search" style="float: left;"/>
                            <button type="submit"  ><i class="fa fa-search"></i></button>
                        </form>
                    </div>

而且不知道如何开始。我想要算法、程序包或任何指导来开始。 请任何人帮助我

【问题讨论】:

    标签: php packages laravel-5.2


    【解决方案1】:

    你可以参考这个 http://fullstackstanley.com/read/simple-search-with-laravel-and-elasticsearch

    设置 Elasticquent

    <?php
    use Elasticquent\ElasticquentTrait;
    
    class Post extends \Eloquent {
      use ElasticquentTrait;
    
      public $fillable = ['title', 'content', 'tags'];
    
      protected $mappingProperties = array(
        'title' => [
          'type' => 'string',
          "analyzer" => "standard",
        ],
        'content' => [
          'type' => 'string',
          "analyzer" => "standard",
        ],
        'tags' => [
          'type' => 'string',
          "analyzer" => "stop",
          "stopwords" => [","]
        ],
      );
    }
    

    【讨论】:

    • 您认为弹性搜索最适合简单搜索?
    • @Sachin 我明白了,但您提供的链接已失效
    猜你喜欢
    • 1970-01-01
    • 2015-01-18
    • 1970-01-01
    • 2016-04-11
    • 2016-12-15
    • 2018-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多