Reply To: Integrating with Elasticsearch

#8019

Ernest Marcinko
Keymaster

Hi!

I'm afraid this might not be implemented any time soon yet.

The search handlers are currently in a re-factoring stage, at some point the current structure will change, as it's a bit outdated. Right now the search process is controlled by a wrapper class: includes/classes/search/search.controller.class.php file.
This then instantiates the required classes for searching within posts, tags, users etc.. and then merging them together etc..

You want to edit the function search() .. in this file. In your case you probably only need the first five line of this function and the return statement, so it would look like this to start with:

function search() {
    $this->parseOptions();

    $sd = &$this->args['instance']['data']; // Search options array
    $s = $this->args['phrase'];   // Search phrase
    $id = $this->args['id'];   // Search instance ID
    
    $results = array();

    // Do your stuff here

    return $results;
}

Try var_dump($results); in the original file first to see how the results structure looks like – you will need to convert the elastic search results to this structure, it's an array of result objects. And that's it basically.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)