M
M
mmka2013-11-13 18:54:12
Laravel
mmka, 2013-11-13 18:54:12

How to use Sphinx along with laravel php framework? Need a kick?

For laravel, there is a Sphinx extension - a link on the github https://github.com/scalia/sphinxsearch. I can't figure out what to put in 'my_keywords_table', and 'id'

return array (
    'host'    => '127.0.0.1',
    'port'    => 9312,
    'indexes' => array (
        'my_index_name' => array ( 'table' => 'my_keywords_table', 'column' => 'id' ),
    )
);

To tell you the truth, I don't understand how this extension works:
$results = SphinxSearch::search('my query', 'index_name')
    ->limit(30)
    ->filter('attribute', array(1, 2))
    ->range('int_attribute', 1, 10)
    ->get();

my_query is, as I understand it, a query like WHERE id=1?
What is index_name?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Tarakhonich, 2013-11-13
@mmka

The my_keywords_table field is your table to be searched, and column is the actual field in the table to be searched.

According to the sources: https://github.com/scalia/sphinxsearch/blob/master/src/Scalia/SphinxSearch/SphinxSearch.php

DB::table($config['table'])->whereIn($config['column'], $matchids)->get();

M
mmka, 2013-11-13
@mmka

Where did $config come from? If this same $config is not where, how does the variable not appear? $matches is already, as I understand it, a variable that comes from the form with a post-request?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question