Answer the question
In order to leave comments, you need to log in
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' ),
)
);
$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);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question