定制 trinityrank/search 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

trinityrank/search

最新稳定版本:v1.3.3

Composer 安装命令:

composer require trinityrank/search

包简介

Search for your website

README 文档

README

Latest Version on Packagist Total Downloads

This package manage all data for search:

  • import
  • update
  • delete)
  • retrive data on frontend

We support multilanguage and shortcode ONLY if you are using our packages:

Installation

- Backend

Step 1: Install package

To get started with Laravel Search, use Composer command to add the package to your composer.json project's dependencies:

    composer require trinityrank/search

Step 2: Namespaces

  • In every tenant config add theese namespaces to include posts/pages/categories in your search
    ...
    // Include for search (articles, pages, categories...)
    'search' => [
        'App\\\Categories\\\Types\\\BlogCategory',
        'App\\\Categories\\\Types\\\NewsCategory',
        'App\\\Categories\\\Types\\\MoneyPageCategory',
        'App\\\Categories\\\Types\\\ReviewPageCategory',
        'App\\\Categories\\\Types\\\DealPageCategory',
        'App\\\Articles\\\Types\\\Blog',
        'App\\\Articles\\\Types\\\News',
        'App\\\Pages\\\Types\\\MoneyPage',
        'App\\\Pages\\\Types\\\ReviewPage',
        'App\\\Pages\\\Types\\\DealPage',
    ],
    ...

Step 3: Add .env params

  • Put your host and secret key into this variables
    SCOUT_QUEUE=false
    SCOUT_DRIVER=meilisearch
    MEILISEARCH_HOST=http://127.0.0.1:7700/
    MEILISEARCH_KEY=null

Step 4: Update config

  • Add this in config/scout.php at the end (if already exist ignore this step)
    ...
    'meilisearch' => [
        'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'),
        'key' => env('MEILISEARCH_KEY', null),
    ],
    ...

Step 5: Database

  • You need to publish migration file from package
    php artisan vendor:publish --provider="Trinityrank\Search\SearchServiceProvider" --tag="search-migration"

And then you need to run migration for all tenants

    php artisan tenant:artisan "migrate"

Or only for one speciffic tenant

    php artisan tenant:artisan "migrate" --tenant=[--TENANT-ID--]

Step 7: Import search data

  • First delete all existing data and old indexes and then do fresh import data and update filters
    // delete
    php artisan search:delete
    php artisan search:delete-index

    // import
    php artisan search:import

    // update
    php artisan search:update-filters

- Frontend

Step 1: Install package

Install this two packages - trinityrank/search-multitenancy: latest version - meilisearch/meilisearch-php: ^0.24.1 or latest

    composer require meilisearch/meilisearch-php
    composer require trinityrank/search-multitenancy

Step 2: Add .env params

Put your host and secret key into this variables

    MEILISEARCH_HOST=http://127.0.0.1:7700/
    MEILISEARCH_KEY=null

Step 3: Publishing

  • You need to publish files from package (config and js file)
    php artisan vendor:publish --provider="Trinityrank\Search\SearchServiceProvider" --tag="search-config"

Step 4: JS

  • Include compiled JS file in your js mix
    ...
    .copy(
        'vendor/trinityrank/search/src/public/js/search.js',
        'public/js'
    )
    ...
  • Than xecute
    npm run dev
  • In your Blade file add this directive to include javascript

    • If you are adding into component add yhis part of code:
        @once
            @push('your-stack-name')
                @searchJs
            @endpush
        @endonce
    • If you are adding into layout you can add like this:
        @searchJs

统计信息

  • 总下载量: 86
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固