Integrating with Elasticsearch

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Integrating with Elasticsearch

This topic contains 2 replies, has 2 voices, and was last updated by Marto Marto 8 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8014
    Marto
    Marto
    Participant

    Dear Team,

    At some stage, we would like to use ASP with an Elasticsearch endpoint.

    Will any future update offer this feature, otherwise, would you please let us know what function we may rewrite ? (simple guideline will suffice.)

    Thank you,

    Best regards.

    #8019
    Ernest Marcinko
    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 :)


    #8027
    Marto
    Marto
    Participant

    Dear Ernest,

    Many thanks for your quick and very useful reply,

    Best regards.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.