nathanillustrate
Forum Replies Created
-
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Search settings not being adhered toThank you
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Search settings not being adhered to@msaari thank you, just to double check what does “Default operator” and “Keyword matching” do in the search settings? from what i can tell “Default operator” being set to “AND – require all terms” means results should contain all words in the search term?
RegardsForum: Plugins
In reply to: [Relevanssi - A Better Search] Search settings not being adhered toHi @msaari ,
Thank you for the quick reply, I can confirm i get the same results in Dashboard -> Admin search as i do on the FE of the site, “current funerals” isn’t mentioned anywhere on the “Our history” page and if i remove the word “current” from the “Our history” page then it stops appearing in the results even though it should only be looking for the whole search term and not individual words.We are also using Version 4.20.0
- This reply was modified 1 year, 9 months ago by nathanillustrate.
Just realised my mistake when posting my code examples i forgot to return $content, sorry and thank you again!
Hello @msaari ,
Thank you for the reply, here is the filter i am using (if i var_dump inside i get an array of correct titles)public function relationship_content( $content, $post ) { // Fetching the post data by the relationship field. $relationships = get_post_meta( $post->ID, 'person_companies', true ); if ( ! is_array( $relationships ) ) { $relationships = array( $relationships ); } foreach ( $relationships as $related_post ) { $content .= ' ' . get_the_title( $related_post ); } }
Below is a debug of relevanssi_modify_wp_query
array(67) { ["s"]=> string(7) "jaywing" ["error"]=> string(0) "" ["m"]=> string(0) "" ["p"]=> int(0) ["post_parent"]=> string(0) "" ["subpost"]=> string(0) "" ["subpost_id"]=> string(0) "" ["attachment"]=> string(0) "" ["attachment_id"]=> int(0) ["name"]=> string(0) "" ["pagename"]=> string(0) "" ["page_id"]=> int(0) ["second"]=> string(0) "" ["minute"]=> string(0) "" ["hour"]=> string(0) "" ["day"]=> int(0) ["monthnum"]=> int(0) ["year"]=> int(0) ["w"]=> int(0) ["category_name"]=> string(0) "" ["tag"]=> string(0) "" ["cat"]=> string(0) "" ["tag_id"]=> string(0) "" ["author"]=> string(0) "" ["author_name"]=> string(0) "" ["feed"]=> string(0) "" ["tb"]=> string(0) "" ["paged"]=> int(0) ["meta_key"]=> string(0) "" ["meta_value"]=> string(0) "" ["preview"]=> string(0) "" ["sentence"]=> string(0) "" ["title"]=> string(0) "" ["fields"]=> string(0) "" ["menu_order"]=> string(0) "" ["embed"]=> string(0) "" ["category__in"]=> array(0) { } ["category__not_in"]=> array(0) { } ["category__and"]=> array(0) { } ["post__in"]=> array(0) { } ["post__not_in"]=> array(0) { } ["post_name__in"]=> array(0) { } ["tag__in"]=> array(0) { } ["tag__not_in"]=> array(0) { } ["tag__and"]=> array(0) { } ["tag_slug__in"]=> array(0) { } ["tag_slug__and"]=> array(0) { } ["post_parent__in"]=> array(0) { } ["post_parent__not_in"]=> array(0) { } ["author__in"]=> array(0) { } ["author__not_in"]=> array(0) { } ["ignore_sticky_posts"]=> bool(false) ["suppress_filters"]=> bool(false) ["cache_results"]=> bool(true) ["update_post_term_cache"]=> bool(true) ["update_menu_item_cache"]=> bool(false) ["lazy_load_term_meta"]=> bool(true) ["update_post_meta_cache"]=> bool(true) ["post_type"]=> string(3) "any" ["posts_per_page"]=> int(10) ["nopaging"]=> bool(false) ["comments_per_page"]=> string(2) "50" ["no_found_rows"]=> bool(false) ["search_terms_count"]=> int(1) ["search_terms"]=> array(1) { [0]=> string(7) "jaywing" } ["search_orderby_title"]=> array(1) { [0]=> string(166) "wp_posts.post_title LIKE '{90b7f02b0d5909ede9f6dcd3f88da165ce598cc1e131125ddcefeddf34c23748}jaywing{90b7f02b0d5909ede9f6dcd3f88da165ce598cc1e131125ddcefeddf34c23748}'" } ["order"]=> string(4) "DESC" }
Below is a debug of relevanssi_query_filter
string(491) "SELECT DISTINCT(relevanssi.doc), relevanssi.*, relevanssi.title * 5 + relevanssi.content * 1 + relevanssi.comment * 0.75 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi WHERE (relevanssi.term LIKE 'jaywing%' OR relevanssi.term_reverse LIKE CONCAT(REVERSE('jaywing'), '%')) ORDER BY tf DESC LIMIT 500"
And relevanssi_results doesn’t include the ID of the post i am looking for even though the search term is the exact name of what is selected in the field, indexing of ACF fields is enabled and i have also rebuilt the index and cleared all caching
- This reply was modified 2 years, 3 months ago by nathanillustrate.