How can I exclude these fields from indexing?
-
How can I exclude these fields from indexing?
relevanssi.comment relevanssi.link relevanssi.author relevanssi.category relevanssi.excerpt relevanssi.taxonomy relevanssi.customfield relevanssi.mysqlcolumn
and leave these:
relevanssi.title relevanssi.content relevanssi.tag
-
All of those need to be explicitly enabled in Relevanssi settings, so just go through the indexing settings and disable everything. This will leave you titles and content. Then just enable tags from the indexing settings, reindex and you’ll be fine.
It’s turned off in my settings, but when I use search, it still searches all the content.
The screenshot shows.Perhaps there is a filter to deny forcibly?
Those fields are always included in the query, but it doesn’t matter, because that content is simply not indexed and doesn’t exist in the Relevanssi index, so it doesn’t have any effect.
Then please tell me how I can increase the speed of the results.
Since if you enter several words (4-8), then the search searches for the desired text for 8 seconds.
I thought the reason was that Relevanssi is looking for extra fields.
By the way, standard search finds long text much faster. And it also has a relevance search. But I really like your plugin.
That’s not a surprising result: the default WP search is faster than Relevanssi, at least until it isn’t. The default search gets really slow when the site reaches certain size.
Since you’re already using Query Monitor, how long do the Relevanssi queries take to run? Are there are any particularly slow queries?
Are you using Relevanssi-generated excerpts? If you are, how much faster is the search if you disable the excerpts?
Searching your plugin for small words does even faster searches than the default WP search, but if you enter a long phrase, the search takes a very long 7-8 seconds (checked through Query Monitor). Sometimes it throws a 500 error. For PHP I have already increased the memory to 1GB. I tried to increase it to 2GB. – to no avail.
The search only searches for titles and content. If you turn off content, then this problem is solved. But search on content is also important to me.
Sorry for my bad english.
Which queries in the Query Monitor take the most time?
How big is your site, how many posts indexed by Relevanssi? Is the “throttle searches” setting enabled?
If you disable Relevanssi custom excerpts, does that help?
Which queries in the Query Monitor take the most time?
44447 documents in the index.
2545051 terms in the index.
Data from Query Monitor:“Throttle searches” helps, but there is a significant disadvantage – then not all of the results are shown. If the result is sorted by date, then the newest posts are hidden in the “throttle searches” mode.
“custom excerpts” – Did I not enable it, or is it by default?
Ok, that settles it: with 44k posts, it’s just not possible to get faster results with multi-word queries from Relevanssi without the throttle. It’s just not technically possible, common words will fetch so many posts from the database that going through all them will take time, and there’s no way to make that faster. With rare words, the search may still be reasonably fast.
I assume if you look at the individual queries, if you have two search terms you have two queries, one for each word, and if the whole search takes about 8 seconds, each will then take about 4 seconds? That’s what’s happening there: each word you add to the search adds a new query, which may then add thousands of new posts to the search.
There’s a problem with the throttle and sorting posts by date, yes. Then again, if you’re not sorting by relevance and are mostly searching titles and content, you might just do well enough with the default WP search – it includes all the posts, sorts by date the same way Relevanssi does and is reliably faster.
Have you considered using Relevanssi Light? It’s much faster than Relevanssi or the default WP search, and doesn’t have a problem sorting posts by date.
Your search for rare words is much faster than the standard one. I also really like the ability to use synonyms.
Relevanssi Light is unfortunately not supported by my PHP version.
Thanks for the explanation.
Can you limit the number of words in content searches? In theory, this should help.
-
This reply was modified 4 years, 6 months ago by
fRMxGqHG.
What do you mean “limit the number of words”? There are plenty of filters that can be used to modify what is search and what gets indexed, so yes, it’s probably possible.
You can also try this:
add_filter( 'relevanssi_join', 'rlv_join_posts' ); function rlv_join_posts() { global $wpdb; return "LEFT JOIN ($wpdb->posts AS posts) ON (relevanssi.doc = posts.ID)"; } add_filter( 'relevanssi_query_filter', 'rlv_order_by_date' ); function rlv_order_by_date( $query ) { return str_replace( 'ORDER BY tf DESC', 'ORDER BY posts.post_date DESC', $query ); }This will sort the posts by
post_dateinstead of relevancy, so you can use the throttle with the date sorting.I am very grateful to you. Your advice helped me achieve good speed without sacrificing search.
-
This reply was modified 4 years, 6 months ago by
The topic ‘How can I exclude these fields from indexing?’ is closed to new replies.