M
M
mr_Nemo2014-09-16 07:14:36
Sphinx
mr_Nemo, 2014-09-16 07:14:36

How to do site search on Laravel 4 and sphinxsearch?

Hello!
I need a search for a digital library site. I am trying Laravel framework. I wanted to use sphinxsearch for searching, but something doesn't work.
config.php

return array (
  'host'    => '127.0.0.1',
  'port'    => 9312,
  'indexes' => array (
    'testindex' => array ( 'table' => 'books', 'column' => 'title' ),
  )
);

for the test wrote in routes.php:
$keyword = Input::get('keyword');

  $books = SphinxSearch::search('%'.$keyword.'%', 'testindex')->get();

/*	$books = Book::where('title', 'LIKE', '%'.$keyword.'%') -> get();
*/
  var_dump('поиск книг');

  foreach ($books as $book) {
    var_dump($book->title);
  }

Who has experience, what else is needed to use sphinx?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-09-16
Protko @Fesor

https://github.com/scalia/sphinxsearch + read the docs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question