Giter Site home page Giter Site logo

full-text-search-laravel's Introduction

full-text-search-laravel

full text search in laravel with more than one field

#install

  composer require 5dmatwebsearch/advancesearch:dev-master

#add service provider

   AdvanceSearch\AdvanceSearchProvider\AdvanceSearchProvider::class,

#add aliases

   'Search' => AdvanceSearch\AdvanceSearchProvider\Facades\SearchFacades::class,

#add index add index to fields

  php artisan index:table table fields

table = the table name
fileds = the fileds you can add one field or more than one like this title,description,tags

example

  php artisan index:table films title,description

#search now you can use the search function

  Search::search(modelName , feilds, searchText  ,select , order , pagination , limit)

modelName = the table name
fileds = the fileds you can add one field like title or more than one like this ['title' , 'description']
searchText = the text you look for
select = the fields you want to return with you can return with one field like this title or more then one like ['title' , 'description']
order = you can pass only the order field like this id or you can pass the field and the way like this ['id' , 'desc']
pagination = true if you want false if not if you not pass this , pakage will paginate by default
limit = how many result you want 10 by default

example with pagination

Search::search(
      "Films" ,
      ['title' , 'description'] ,
      "Drama Outback GOLDFINGER"  ,
      ['modelName' , 'title', 'description'],
      ['film_id'  , 'asc'] ,
      true ,
      30
)

other example with pagination

Search::search(
      "Films" ,
      ['title' , 'description'] ,
      "Drama Outback GOLDFINGER"  ,
      ['id' , 'title', 'description'],
     'film_id'  
)

example without pagination

Search::search(
      "Films" ,
      ['title' , 'description'] ,
      "Drama Outback GOLDFINGER"  ,
      ['film_id' , 'title', 'description'],
      'film_id',
      false
)->where('film_id' , 10)->get()

full-text-search-laravel's People

Contributors

zizohassan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.