2017 © Pedro Peláez
 

library lumen-xunsearch

Xunsearch Driver for Laravel Scout.

image

xcalder/lumen-xunsearch

Xunsearch Driver for Laravel Scout.

  • Wednesday, July 25, 2018
  • by xcalder
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

Lumen XunSearch

Xunsearch Engine for Laravel Scout., (*1)

Installation

You can install the package via composer:, (*2)

composer require liugj/lumen-xunsearch

You must add the Scout service provider and the package service provider in your bootstrap/app.php line 80 config:, (*3)

$app->register(Liugj\Xunsearch\XunsearchServiceProvider::class);

Configuration

Publish the config file into your project by edit config/scout.php line 62:, (*4)

    'xunsearch' => [
        'index'  => env('XUNSEARCH_INDEX_HOST', ''),
        'search' => env('XUNSEARCH_SEARCH_HOST', ''),
        'schema' => [
           'brand_index'=>app()->basePath()  .'/'. env('XUNSEARCH_SCHEMA_BRAND'),
        ]
    ],

Add Xunsearch settings into .env file:, (*5)

SCOUT_DRIVER=xunsearch
XUNSEARCH_INDEX_HOST=127.0.0.1:8383
XUNSEARCH_SEARCH_HOST=127.0.0.1:8384
XUNSEARCH_SCHEMA_BRAND=config/brand.ini

Usage

Now you can use Laravel Scout as described in the official documentation., (*6)

Where Clauses

This enginge allows you to add more advanced "where" clauses., (*7)

  • addRange
   $users = App\User::search('Star Trek')
            ->where('age', new \Liugj\Xunsearch\Operators\RangeOperator(30,50))->get();
  • setCollapse
   $users = App\User::search('Star Trek')
            ->where('city', new \Liugj\Xunsearch\Operators\CollapseOperator($num = 10))->get();
  • setFuzzy
   $users = App\Users::search('Star Trek')
           ->where('**', new \Liugj\Xunsearch\Operators\FuzzyOperator($fuzzy = false))->get();
  • setFacets
   $users = App\Users::search('Star Trek')
            ->where('***', new \Liugj\Xunsearch\Operators\FacetsOperator(array('age','city')))->get();
  • addWeight
   $users = App\User::search('Star Trek')
   ->where('country', new \Liugj\Xunsearch\Operators\WeightOperator('US'))->get();

Configuring Searchable Data

By default, the entire toArray form of a given model will be persisted to its search index. If you would like to customize the data that is synchronized to the search index, you may override the toSearchableArray method on the model:, (*8)

<?php

namespace App;

use Liugj\Xunsearch\Searchable;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use Searchable;

    /**
     * Get the indexable data array for the model.
     *
     * @return array
     */
    public function toSearchableArray()
    {
        $array = $this->toArray();

        // Customize array...

        return $array;
    }
}

Credits

License

The MIT License (MIT)., (*9)

The Versions

25/07 2018

dev-master

9999999-dev

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

25/07 2018

v1.3.0

1.3.0.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

07/06 2018

v1.2.8

1.2.8.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

07/06 2018

v1.2.9

1.2.9.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

06/02 2017

v1.2.7

1.2.7.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

06/02 2017

v1.2.6

1.2.6.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

04/02 2017

v1.2.5

1.2.5.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

18/01 2017

v1.2.4

1.2.4.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

18/01 2017

v1.2.3

1.2.3.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

11/01 2017

v1.2.2

1.2.2.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

11/01 2017

v1.2.1

1.2.1.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

11/01 2017

v1.2

1.2.0.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

11/01 2017

v1.1

1.1.0.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch

10/01 2017

v1.0

1.0.0.0

Xunsearch Driver for Laravel Scout.

  Sources   Download

MIT

The Requires

 

by Avatar liugj

lumen scout xunsearch