I am wicked excited to be publishing this post. Not because it has to do with shipping code or any of that, but because I’ve built something that’s going to make my life (and hopefully yours) that much easier once you’ve read it.
Many times when I sit down to build a plugin it’s a result of two circumstances. The first is impulsive inspiration that I can’t quite seem to get out of my mind in a day. Plugins like Widget Image Field and Relief Splash Page fit into that category.
Other times the idea quite simply simmers. It takes it’s time to form for me and I need to have it just rest in my subconscious for any number of reasons. Maybe I have no idea how to build it. Maybe I’m just not sure it makes any sense. Maybe it’s one of those things that only I do (and I’m probably doing it wrong anyway). Needless to say the ideas take their time coming to fruition if they even make it that far. Plugins like Attachments and Hierarchy fit that scenario. By nature, plugins like those require that prospective users share some sort of frustration I have, or they do something potential developers didn’t even know they wanted.
Today brings something new to the table. I’ve had this plugin rolling around in my head for at least the past couple of years, but it wasn’t until a few months ago that the official lightbulb went off. The main idea was to tackle WordPress search, but I wanted to do it my way.
The state of WordPress search
People love to hate WordPress search. The biggest problem people have with it is the relevancy because WordPress orders results by date descending. At the end of the day it’s not a huge deal, because WordPress is doing full-text searches on your content (for the most part) and you’re probably going to get the post you’re looking for. But that’s where it stops, that’s all you get.
Out of a need for a more relevant WordPress search, a number of plugins came out that did awesome things. They’d boost relevancy of search and do a great job at it. Unfortunately for me, I build a lot of complex client websites, and the settings for these solutions weren’t comprehensive enough for me.
The other option is to go completely offsite and use something like Google Custom Search or simply link to a DuckDuckGo results page. While that gets the job done, it’s so detached from the theme I just spent so much time building from the ground up. Further, it seems like Google Custom Search in particular gets more and more cumbersome to work with each time I need to integrate it. I’d much prefer to have WordPress take care of the work.
For example, I use a ton of Custom Fields, but they all don’t necessarily carry the same weight. I want to pinpoint keyword weights per Custom Field. I also use taxonomies in a variety of ways, I can’t set a blanket rule that taxonomy terms all carry the same keyword weight. I want to single out taxonomies when weighting keywords.
I wanted a search plugin that would primarily take on those tasks along with the features everyone would expect out of a WordPress search plugin. Things like excluding post IDs, excluding categories (or tags, or any taxonomy term entirely), or excluding entire post types from search.
SearchWP does all that and more
Building a search plugin was one of those things I’ve had on my mind forever, but didn’t really think I’d ever get to it. A combination of increased need and WordPress core awesomeness changed that though. I was working on a client project and they indicated that they wanted to integrate Google Custom Search. I checked things out for the first time in a while only to realize that the integration process changed completely, again. For some reason that was the straw that broke the camel’s back and I immediately put together how I think a search plugin done my way would work. That was a few months ago and here we are, launch day.
My main goal with SearchWP was to build my dream search plugin, one that’s going to work exactly how I want it to given my client oriented workflow. A major inspiration for that was to figure out how to best handle Custom Field indexing and searching. Adding a blanket rule to take
wp_postmeta into consideration was out of the question, I wanted SearchWP to be fast. That said, instead of starting on a code level I began to brainstorm about what the UI would look like, what I’d want to see when I first discovered my new favorite search plugin.
At the top level I wanted control over which post types were included in search results, even if
exclude_from_search was set to false. Sometimes that’s out of my control and other times I want to build a search that just appears in one section of the site. A ha! Another feature… The next most important thing is the ability to apply weights to keyword hits based on where they appear. I agree with foundational SEO techniques that outline a keyword appearing in a title or URL is a bit more weighty than that of the same occurrence in a comment. I wanted to be able to differentiate that on a per post type basis. Additionally I wanted to have all the exclusion rules I’d normally expect, in case I found myself in a situation where a group of posts shouldn’t be considered at all.
From there I did a bit of blue sky thinking and thought about what else would really enhance the majority of our client sites. I came up with a short list:
- Keyword stemming
- PDF indexing
- Content attribution
- Supplemental search engines
These four features are what I think complete the foundational feature set I see SearchWP providing as a platform for search.
- Keyword stemming
- Keyword stemming involves both the indexer and the search algorithm working with the stem of each term instead of the actual term itself. That is to say, with keyword stemming disabled separate searches for ‘run’ and ‘running’ would yield different results. With keyword stemming enabled they’d return the same set of posts.
- PDF indexing
- This is no joke. PDFs are completely wacky but I really wanted to see what could get done with that. As it turns out, the overall architecture of SearchWP catered really well to supporting this feature. While I can’t guarantee every PDF under the sun can get indexed, chances are pretty good if you’re able to highlight the text when viewing your PDF. As a backup, I’ve added a meta box with a textarea that will be populated with the indexed content, allowing you to customize it.
- Content attribution
- This feature is by far the hardest to explain, but if you’ve ever been in the situation I think you’ll like it. Have you ever used a CPT to populate a section of content within a Page? I have for things that can be compared to including an FAQ under a content block. The actual URL would sit at
/faqwhich is a WordPress Page, allowing admins to control the content of the page itself, but the page template pulls in all of the
faqCPT entries and lists them out on the page. Depending on how you registered the post type, you could potentially get search results pointing to the CPT permalink instead of the FAQ page. SearchWP can accommodate for that by letting you attribute search results to the FAQ page ID, so any weight afforded to a CPT entry will instead be attributed to the FAQ page entirely.
- Supplemental search engines
- As a result of my ah-ha! moment when thinking about initial steps with SearchWP, I realized that there have been times when I’ve had to set up a secondary search on a site, that only took specific things into consideration. The most common cause was implementing a search for a single section of a website that happened to be pretty substantial, where a search form would make sense. I didn’t want to mess with the main, site-wide search, so I had to build something in by hand. SearchWP supports this functionality out of the box, you can create any number of supplemental search engines and each has it’s own set of settings, completely separate from the default search engine configuration.
Beyond those four additional features, I wanted to focus on speed and transparency with SearchWP. The plugin maintains it’s own search index so as to make actual queries as fast as possible. The initial indexing is performed as soon as the plugin is activated, and then it applies delta changes to the index as you edit your content. There’s minimal interference with your publishing process when it comes to SearchWP.
SearchWP was also designed to adapt to the needs of anyone running a WordPress site, I didn’t want you to have to crack open your template files to get it working. So SearchWP has been built as a turnkey solution, you can literally install and activate the plugin and it just starts working. It pipes directly into the native WordPress search workflow, and injects it’s results at just the right time. It also caters to the developers that want or need to tinker with every aspect of the search algorithm. SearchWP aims to please all.
Check it out, get 25% off
As part of the launch, I’m running a social discount for 25% off any license level. If you’re at all interested in improving WordPress search on either your projects or in your client work, I hope SearchWP does exactly that for you.