Forums › Forums › Search & Filter Pro › Elastic Search/Press
Tagged: elasticpress, ElasticSearch, indexing
- This topic has 1 reply, 2 voices, and was last updated 3 years, 11 months ago by Trevor.
-
Anonymous(Private) December 11, 2020 at 3:32 am #269505
Hi Trevor,
I have Elastic search setup on server and working (I tested it with different queries). I also installed ElasticPress plugin. I would like now to integrate it with S&F. I read these two posts:
https://support.searchandfilter.com/forums/topic/algolia-vs-elastic-search-vs-search-filter-pro/
https://support.searchandfilter.com/forums/topic/working-with-elasticpress-elasticsearch/But could you please give more details how to use the sf_edit_query_args?
1) I am putting it in functions.php of the child theme but how the sfid is passed to it (is there a way to make sure it is passed correctly to the function)?
2) I am using for Display Results “Using shortcode”, and I am customising the results as mentioned here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
should I use another Display results method?3) I am using “Load results using Ajax”, should I disable it?
4) should I rebuild the cache of S&F after adding the above code to functions.php?
(Note I was using Relevanssi before but I disabled it now).5) Is there a way to test that the s&F is using ElasticPress?
Thanks,
AhmedTrevor(Private) December 11, 2020 at 10:34 am #2695351. You code the SFID (which is the ID number of the form), like this (assuming the form ID is 1234, but you will need to change that to match the ID of your form):
function filter_function_name( $query_args, $sfid ) { if($sfid==1234) { $query_args['ep_integrate'] = true; } return $query_args; } add_filter( 'sf_edit_query_args', 'filter_function_name', 20, 2 );
Our function (sf_edit_query_args) passes the sfid itself.
2. This method works irrespective of the Display Results Method you use in the form.
3. That is your choice, depending on how you want your site to work, but again this method works irrespective of the Ajax setting in the form.
4. No need to rebuild the cache.
5. Not really. There may be a monitor function on your server to show if it is being used. -
AuthorPosts