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 4 years, 5 months ago.
- AuthorPosts
- December 22, 2018 at 6:26 pm #20533
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.December 23, 2018 at 9:49 am #20538Hi,
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 :)
December 25, 2018 at 10:26 pm #20543Hello 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
December 27, 2018 at 10:57 am #20549Hi 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:
Best,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; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.