Sphinx search on outer sql-tables with ajax on wp

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Sphinx search on outer sql-tables with ajax on wp

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 5 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #20533
    fel
    fel
    Participant

    Is it possible to integrate a custom sql search result into the ajax search field?
    I use sphinx for collecting jobs into one index. So I need an ajax inteegration. But the plugin serves only wp_ tables, or?
    May you have an idea how to make this possible.

    #20538
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    At the moment this is not possible without major modifications to the plugin core code. The custom query is only one issue, a bigger problem is, that the results from a custom query need to be converted to a results object as well. There is no easy way of doing this currently.

    Best,
    Ernest Marcinko

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


    #20543
    fel
    fel
    Participant

    Hello Ernest,
    thanks for reply. I think one way could be, to inject additional data on the point where the plugin the data is collecting.
    Second, it plays only a role to me to influence the search data like in List of google suggestsions.
    Or is it possible, to add more data to the index tabel? Is it a text file or a table in wordpress?

    Grüsse

    #20549
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Grüsse,

    That is possibe by using hook functions. There are a number of filters available before the tokenization process, where you can add additional text as you like. I will list these filters below, you can also find them in the wp-content/plugins/ajax-search-pro/includes/classes/etc/indextable.class.php file:

    apply_filters( 'asp_post_content_before_tokenize', $content, $the_post );
    apply_filters( 'asp_post_excerpt_before_tokenize', $the_post->post_excerpt, $the_post );
    apply_filters( 'asp_post_title_before_tokenize', $the_post->post_title, $the_post );
    apply_filters( 'asp_post_permalink_before_tokenize', $the_post->post_name, $the_post );
    apply_filters( 'asp_post_custom_field_before_tokenize', $values, $the_post, $field );

    As an example, let’s say you want to append additional text to the post content before it’s processed by the keyword tokenizer. Then this code is a good start-off:

    add_filter('asp_post_content_before_tokenize', 'my_custom_asp_post_content_before_tokenize', 10, 2);
    function my_custom_asp_post_content_before_tokenize($content, $the_post) {
         /**
          * Do your custom queries here, and append the results to the $content variable
          * 
          * More info           
          *   $content is the post content that is tokenized       
          *           
          *   $the_post is the currently processed post object.
          *   The post ID is in $the_post->ID attribute
          **/                 
         return $content;
    }
    Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.