Different Search for Stopwords?
-
Hi,
Working on a environmental science site that has many repeated words scattered throughout the content. As the plugin suggests, they’re perfect candidates for stopwords because the results are pretty useless (and can take forever to return).
What would be a happy medium for me would be to search titles only for any of these common words. For instance, searching for “water” is just silly but so is ‘no posts found’.
I understand that there is only one stopwords list so it wouldn’t make sense to key off of that. I’m happy to maintain a separate ‘common words’ list.
I found the
relevanssi_query_filter
andrelevanssi_modify_wp_query
filters in the documentation. Seemed like the right spots but I couldn’t work out how to utilize them for the ends I seek.Is it possible to one of those filters (or something else) to either stop the query before going through Relevanssi (doing a custom query) or adjust the Relevanssi search to say ‘titles’ only?
Or is there a way to set those words someplace and use a filter to tell Relevanssi to ‘only index these words in post titles’ no matter what I have set in the plugin’s settings page?
If it comes to it, I guess I can add my common words to the stop word list, also maintain them separately and if
is_search()
and if no results, check the search term to see if it’s in the common words list and run my custom search. Seems like there’s a probably a cleaner way that I’m just missing being new to the plugin.Sorry for the long question and thanks for Relevanssi!
- The topic ‘Different Search for Stopwords?’ is closed to new replies.