0

I am using Laravel 5.3 and i was trying to use sngrl sphinx, following this git : https://github.com/sngrl/sphinxsearch.

I followed all the installation and configuration steps, but in the end when i try to use, i got always return null ( the answer is false).

This is the configuration:

<?php
return array(
    'host'    => '127.0.0.1',
    'port'    => 3306,
    'timeout' => 30,
    'indexes' => array(
        'my_index_name' => array('table' => 'users', 'column' => 'email'),
    ),
    'mysql_server' => array(
        'host' => '127.0.0.1',
        'port' => 3306
    )
);

, And this is where i am trying to do the query :

public function teste(Request $request)
{
    $sphinx = new SphinxSearch();
    $results = $sphinx->search('daniel@gmail.com', 'users_index');

    dd($results);

    return back();
}

or something like this to select all

 public function teste(Request $request)
    {
        $sphinx = new SphinxSearch();
        $results = $sphinx->search('', 'users_index');

        dd($results);

        return back();
    }

The result is this : http://prntscr.com/ec33mr

I belive that i could be missing something but i don't know.

I searched about it, but i can't find mutch information about it, if anyone can help me plz.

António Gonçalves

  • *Do you definitly have a searchd daemon running on the server, and listening on port **3306** ?* (Also note that port 3306 normally used for mysql server, so if have searchd API running there instead, that seems kinda confusing) pt 9312 is more commonly used for SphinxAPI Protocol. – barryhunter Feb 22 '17 at 22:48
  • i don't have searchd daemon running becouse i didn't know if i have to. I only followed the guide i linked. But you mean, i need to have an api running to use this Sphinx. I think i will try then – António Gonçalves Feb 23 '17 at 11:01
  • YEs, you need a server running (and with it some indexes for it search!). The server is the part that actually 'answers' the query. The PHP class is just a convenient **wrapper**, that forwards queries to Sphinx server. Guess that article assumes you *already* have a functioning server! – barryhunter Feb 23 '17 at 14:13
  • With your help i could put it running. Now i am exploring it trying to get full extension of it – António Gonçalves Feb 23 '17 at 14:44

1 Answers1

0
public function teste(Request $request)
{
    $sphinx = new SphinxSearch();
    $results = $sphinx->search('', 'users_index')->get();

    dd($results);

    return back();
}

Please try this, Reference : https://github.com/sngrl/sphinxsearch#usage

Sérgio Reis
  • 2,483
  • 2
  • 19
  • 32