Version 1.9.7 is now available to all active license holders and is a recommended upgrade for everyone. The effort to refine and optimize SearchWP while trimming down the overall footprint continues. A new filter has been added to allow you to completely omit comments from being indexed. If you don’t plan on using comments to boost search results, you can feel free to take advantage of this filter to keep your index as small as possible.
There were some other good bug fixes in this release, including a more aggressive implementation of the regex whitelisting functionality. SearchWP runs content through various regular expression patterns to extract terms that would normally be stripped apart by the indexer as per their punctuation. Things like dates, phone numbers, function names, initials, and other phrases that should be kept in tact are held together when they match any of the regular expression patterns in the whitelist. You have full control over this whitelist via the
searchwp_term_pattern_whitelist filter, so if you don’t care for the default patterns or want to add your own you can take advantage of that.
Term Highlight 1.6
Along with this release comes an update to Term Highlight (now at version 1.6) which integrates SearchWP’s term whitelist implementation, and also offers a completely new function:
searchwp_term_highlight_the_excerpt_global(). It might be wordy, but it does something pretty neat. The function is designed to replace
the_excerpt() in your search results templates. Normally excerpts are limited to the specific Excerpt meta box or the main content editor of posts as a fallback to that. This function will also take into consideration the Custom Fields associated with posts and extract whatever it can from that Custom Field data if the default excerpt does not have a search term in it. With this single function call you’ll get a targeted, highlighted excerpt if there’s one to be had.
Please note that automatic updates are not supported for Extensions at this time, so you’ll need to manually update from your Account area.
Also available now to all active license holders is a new Extension called Diagnostics. The purpose of this extension is to facilitate information extraction about the SearchWP index. It’s only got one feature for launch, but it’s a helpful one particularly if you’re experimenting with your own regex whitelist patterns. SearchWP Diagnostics will expand with more features over time, but version 1.0 has a feature allowing you to enter in a post ID and have it spit out every term in the index for that post:
I’m very much looking forward to expanding the feature set for Diagnostics, and would welcome any feature requests if there is more information you wish were readily available about the SearchWP index.
Full 1.9.7 changelog
- [New] New Filter:
searchwp_index_commentsallows you to prevent comments from being indexed
- [Improvement] Prevented potential edge case where the indexer may stall after completing a delta update
- [Improvement] More aggressive implementation of term regex whitelist (matches are now indexed fully in tact and not broken apart)
- [Fix] Fixed an issue where problematic posts that failed to index were not properly called out in the WordPress admin
- [Fix] Fixed an issue where ‘Any’ Custom Field may not have applied correctly