Having created numerous websites with search features, we’ve come to realize that people often overlook the importance of PDF indexing.
While WordPress allows you to upload PDFs easily, it doesn’t include their contents in search results by default. This oversight can significantly hinder your visitors’ ability to find crucial information.
In this guide, we’ll show you how to add PDF indexing and searching to WordPress, enhancing your site’s search functionality and improving user experience.
Why Make WordPress Search PDF Files?
If you upload PDF files to your WordPress site, you can offer your visitors downloadable ebooks, user manuals, catalogs, and more. You can even add a PDF viewer in WordPress, so customers and visitors can see the PDF’s contents without downloading it.
By default, the built-in WordPress search shows the title and description of your PDFs and other files in its search results. However, it doesn’t show the document’s contents.
This isn’t very helpful and makes it more difficult for visitors to find what they’re looking for, even if the PDF is a good match for their search query.
The good news is that you can improve the WordPress search so that it includes PDF and other file contents in its search results.
With that being said, let’s take a look at how to add PDF indexing and searching in WordPress. You can use the quick links below to navigate through this tutorial:
Step 1: Install and Set Up SearchWP
The best way to add PDF indexing and searching in WordPress is by using SearchWP. It is the best WordPress search plugin that allows you to include all kinds of content in your search results, including custom post types, WooCommerce products, comments, PDFs, and more.
You can see our complete SearchWP review for more details.
The first thing you need to do is install SearchWP. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, go to SearchWP » Settings and then click on the ‘General’ tab.
Here you need to enter your license in the ‘License Key’ box. You can find this information under your account on the SearchWP site. Once you’re done, make sure to click the ‘Verify Key’ button.
Step 2: Customize Your WordPress PDF Search Algorithm
With that done, you’re ready to add the contents of your PDF documents to the WordPress search engine results, by going to SearchWP » Algorithm.
This brings you to a screen where you can specify what SearchWP should include in its search results, such as pages and posts.
By default, SearchWP should search your site’s media files. However, if you can’t see a ‘Media’ section, then you will need to add it by clicking the ‘Sources & Settings’ button.
This shows all the different content that you can include in the WordPress search results. For example, you can make blog comments searchable in WordPress.
In the popup, select ‘Media’ and then click on ‘Done.’
To make the search engine index PDF files in WordPress, scroll to the ‘Media’ section.
Here, click on the ‘Add/Remove Attributes’ button.
In the popup that appears, check the ‘Document Content’ box, if it isn’t already selected.
This settings tells SeachWP to index the contents of your PDFs, Microsoft Office files, text files, and other documents in the WordPress media library. It will then include this content in any relevant search results.
You should also check the ‘PDF Metadata’ box. SearchWP will then index PDF metadata that isn’t part of the file’s contents, such as its title, author, subject, and keywords.
Depending on the PDF, this may help visitors find what they’re looking for.
For example, if you run an online marketplace, then metadata can help shoppers find the PDF user manual for a specific WooCommerce product. With that in mind, it’s often smart to include this information in the search results.
When you’re happy with the changes you’ve made, click on the ‘Done’ button.
‘Document Content’ and ‘PDF metadata’ will now appear in the ‘Media’ section, along with any other attributes that SearchWP searches by default such as title and slug.
You’ll notice that each item has an ‘Applicable Attribute Relevance’ scale. This is the weight that SearchWP will give to each attribute.
Content that matches an attribute with high relevancy will appear higher in the search results. By contrast, content that matches an attribute that has less relevancy will appear lower in the user’s search results.
By default, the sliders for Document Contents and PDF Metadata are all the way to the left, so they don’t carry much weight. If you want the document content and PDF metadata to have a bigger impact on the search results, then simply move the sliders.
Every WordPress website is unique, so you may want to try different relevancy settings to see what gives you the most accurate and helpful search results.
For example, if you’ve uploaded the menu as a PDF on your restaurant website, then this is important content and you’ll typically want to show it high in the search results.
Once you’re happy with how the search feature is set up, scroll to the top of the screen and click the ‘Save’ button.
SearchWP will now rebuild the index automatically. Depending on the speed of your Internet connection and your WordPress hosting provider, this may take a few minutes.
As soon as you see ‘Index Status 100%,’ you’ll know that SearchWP has added all the PDF contents and metadata to its search index.
Congratulations! Your WordPress blog, website, or online store will now show PDF content and metadata in its search results.
Step 3: Create and Embed a Custom Search Form (Optional)
Technically, you only need to complete steps 1 and 2 to make PDF files searchable in WordPress. But if you want to improve your WordPress search experience even better, then we suggest creating a custom search form, too.
Doing this lets you build a search bar that’s better suited to your users’ search behavior. Perhaps you have a lot of content on your site, and your visitors prefer using a search bar with menus to narrow down their findings.
If you want to build a custom search form, you can read our guide on how to create a custom WordPress search form.
You may also want to check out our article on how to create an advanced search form for custom post types if you deal with a lot of non-blogging content.
Additionally, you may want to edit your search results page to make it even more user-friendly. For this, you can read our guide on how to customize the search results page in WordPress.
Make the Most of SearchWP and Improve WordPress Search
Now you’ve added PDF indexing and searching in WordPress, you may want to enable some of SearchWP’s more advanced features. This will make it even easier for visitors to find what they’re looking for.
To do that, go to SearchWP » Settings and scroll to the ‘General Settings’ section.
Here, you can activate any of the following settings:
- Partial matches. With this setting enabled, SearchWP will display results that aren’t an exact match for the visitor’s search query. You can learn more about this in our article on how to add fuzzy search in WordPress.
- Closest match. After enabling partial matches, you can also show the closest matches when a search has no results.
- “Quoted” searches. This allows visitors to search for exact phrases use quotes.
- Highlight terms. Automatically highlights the search terms to help visitors find what they’re looking for.
Another thing you can do is enable live AJAX search in your search algorithm. This means your search bar will show results as the visitor is typing into it, making it quicker for them to find answers.
We hope this tutorial helped you learn how to add PDF indexing and searching in WordPress. You may also want to learn how to create a WordPress membership site or check out list of must have plugins to grow your site.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Ed Tow
DYNAMITE post! The reasons you give are several well-chosen ones out of literally dozens. For many non-profits and others, “newsletters” have been the very heart of their communications process. “Looking for an article on X” is a close relative of what’s made Google one of the very largest companies on earth. But PDF’s – so very common – are (as you point out) all but “foreign language” for reasons I cannot really grasp. Google ostensibly indexes them, but there is some complexity (way beyond “Were they scanned?”) that renders it hit-and-miss in this connection.
How I hope that SearchWP has some sort of “trial” feature, because if Google hasn’t nailed it, I’m more than a little skeptical that someone else has!
WPBeginner Support
Glad you found our guide and we hope SearchWP fills what you are looking for!
Admin