Open greenSkin opened 3 years ago
Hi @greenSkin 👋
Can you share the code snippets you've tried? Also, is this a site hosted on Pantheon?
Yes, the site is hosted on Pantheon. I've tried a few different things. The simplest was the following:
add_filter( 'solr_index_custom_fields', function( $indexed_keys ) {
$indexed_keys[] = 'solr_search_boost';
return $indexed_keys;
} );
add_filter( 'solr_boost_query', function( $solr_boost_query ) {
return 'post_title^2 post_content^1.2 solr_search_boost^5';
} );
The solr_search_boost
is the field name of my simple ACF text field. Also, when I include "solr_search_boost^5" in the 'solr_boost_query" filter I get 0 search results, even after re-indexing.
Oh! You might've been bit by #359 too.
Solr Power doesn't search against the post meta value by default, so you need to do some code trickery to make that happen.
When boosting, I think you'll need to use solr_search_boost_str
, which is the name of the field as Solr knows it.
Can you try those out and let me know how you progress?
Thanks. I applied #359 solution and it seems to help but I'm still not able to get the boost working. I set the boost to post_title^2 post_content^1.2 solr_search_boost_str^5
but even that ends up giving me 0 results for queries that would have otherwise given results.
I'm trying to use a custom ACF field as a boost keyword field. I'm looking to raise posts to the top of search results based on matches in this field. I've tried using the
solr_index_custom_fields
andsolr_boost_query
filters but have had no luck. Please help!