Relevanssi Premium

Description

Relevanssi replaces the standard WordPress search with a better search engine, with lots of features and configurable options. You’ll get better results, better presentation of results – your users will thank you.

 

KEY FEATURES

  • Search results sorted in the order of relevance, not by date.
  • Fuzzy matching: match partial words, if complete words don’t match.
  • Find documents matching either just one search term (OR query) or require all words to appear (AND query).
  • Search for phrases with quotes, for example “search phrase”.
  • Create custom excerpts that show where the hit was made, with the search terms highlighted.
  • Highlight search terms in the documents when user clicks through search results.
  • Search comments, tags, categories and custom fields.
  • bbPress support.
  • Indexing attachment content (PDF, Office, Open Office).
  • Improved spelling correction in “Did you mean?” suggestions.
  • Searching across multiple sites in the same multisite installation.
  • Search and index user profiles.
  • Search and index taxonomy term pages (categories, tags, custom taxonomies).
  • Assign weights to any post types and taxonomies.
  • Assign extra weight to new posts.
  • Let the user choose between AND and OR searches, use + and – operator (AND and NOT).
  • Highlighting search terms for visitors from external search engines.
  • Export and import settings.
  • Related posts.

Installation

Activate the ‘Relevanssi Premium’ plugin on your desired site.

After enabling, check Settings > Relevanssi to adjust the settings and build the index.

Search widget

Relevanssi doesn’t come with a search widget. You can use the default WordPress search widget or any other method that generates a standards-compliant search form.

Indexing

 

All options on this tab affect the indexing and won’t have any effect until you build the index. You need to save the options before indexing. Clicking Build the index will wipe the index clean and rebuild the complete index, based on the indexing settings you’ve chosen on this tab. The indexing will run until it’s finished. It can take a while, especially on a large site, but the indexing process will show an estimate of the remaining time. Keep the browser window open as long as it takes to index.

If for some reason the indexing is interrupted, you can click the Index unindexed posts. This will index all the remaining posts (including all post types). This button can be useful if you import posts in a way that doesn’t trigger Relevanssi indexing: just click the button after the import to index all the new posts.

State of the index shows the number of documents (posts, pages), users and taxonomy terms (Premium only) in the index, number of terms (words) in the index and the highest post ID in the index. These are useful for debugging purposes, for example to see if the indexing works.

Post types
Just check the boxes for each post type you wish to include in the index. The “Excluded from search?” column shows whether the post type is marked public or not, but it doesn’t mean you can’t index those post types. It’s just for information.

Taxonomies
Choose which taxonomies are indexed for the posts. If you check a taxonomy here, it means that searching for the taxonomy term name will find all posts that have this taxonomy term attached to them. Again, the “Public?” column is just for your information.

Comments
Choose which comments are indexed. You can choose to include only regular comments or also include pingbacks and trackbacks.

Custom fields
Choose which custom fields are indexed. “All” includes all custom fields assigned to a post, “visible” only those that are shown on the edit page. If a custom field name starts with an underscore (_), it is hidden from the post edit page, and won’t be included if this setting is set to “visible”. Since some themes can add quite a bit of behind-the-scenes data in the custom fields, “visible” is a reasonable setting. You can also choose to index only specific fields you list.

 

Author display names
If this option is enabled, Relevanssi will index author display names. Searching for an author will find all posts written by the author.

Excerpts
If this option is enabled, Relevanssi will index post excerpts.

Expand shortcodes
If this option is checked, Relevanssi will expand all shortcodes in post content before indexing the post. That means the shortcode content will be included in the index. This doesn’t always work as expected. If the shortcode provides dynamic content, Relevanssi will index the post with the content at the moment of indexing, and won’t update the index when the dynamic content changes.

Some plugins don’t enable their shortcodes in the admin side, so Relevanssi can’t expand them. Some plugins, especially those that don’t respect WP programming standards, may break Relevanssi. If indexing doesn’t work, one of the first things to try is to disable this option.

Disable these shortcodes
You can list unwanted shortcodes here: if a shortcode is causing problems in indexing, list it here and it will be disabled when Relevanssi indexes posts.

Index user profiles
If this is checked, Relevanssi will index user profiles. Relevanssi indexes first name, last name, display name and user description. You can also index other data for users, see two options down.

Since WordPress expects the search results to be posts, Relevanssi needs to convert the user profiles to posts. That requires some changes in your search results template. the_permalink()should work in most cases, pointing to the user profiles. See User profile search for more information.

Index subscribers
If checked, Relevanssi will also index subscribers, otherwise only admins, editors, authors and contributors are indexed.

Extra fields
If you want to index other user fields, you can list them here. These field names should correspond to MySQL database columns in the wp_user table or user custom fields.

Index synonyms
Synonyms generally only work in OR searches: the synonyms are used by adding more words to the search query and in OR search that works as expected, widening the search. In AND search, it will restrict the search, so it won’t work. Enabling this option will make Relevanssi index the synonyms as part of the post content, making them compatible with AND searches.

Index taxonomy terms
If you enable this option, you can index taxonomy term pages. If this option is enabled, searching for a taxonomy term name will return the term archive page as a result. By default, Relevanssi only indexes those terms that are attached to posts. With this option enabled, get_permalink() won’t work on search results template. the_permalink() does, but if you don’t want to echo the permalink, you can use relevanssi_get_permalink() instead. See Indexing taxonomy pages.

Taxonomies controls which taxonomies are indexed.

Index for parent (Premium only)
If checked, Relevanssi indexes the PDF content both for the attachment post and the parent post. You can control the attachment post visibility by indexing or not indexing the post type attachment.

 

Attachments

Attachments tab

Attachment tab handles the PDF content reading. If you have PDF files in your Media Library, Relevanssi can read in the PDF contents so that they are available for indexing.

In order to read the contents of the PDFs, the files are sent over to Relevanssiservices.com, a PDF processing service hosted on a Digital Ocean Droplet in the USA. The service creates a working copy of the files. The copy is removed after the file has been processed, but there are no guarantees that someone with an access to the server couldn’t see the files. Do not read files with confidential information in them. In order to block individual files from reading, use the Relevanssi post controls on attachment edit page to exclude attachment posts from indexing.

Read all unread PDFs reads in all the PDF content in attachments. This does not wipe the index, and will only process those PDFs which haven’t been read yet. If reading the PDF caused an error message before, the PDF will be skipped, unless the error message is a time out, in which case it’s attempted again.

Reset all PDF data from the posts will empty out the PDF information from the posts. It is stored in the attachment metadata: content in _relevanssi_pdf_content and errors in _relevanssi_pdf_error. Clicking this button will wipe these custom fields empty.

Upload PDF files
By default Relevanssi sends a link to the PDF to the reading service, which then downloads the PDF and reads it. However, if your files are behind a firewall, in an intranet or otherwise not accessible from the outside world, this is not going to work. In that case, check this option, and Relevanssi will upload the files directly.

Link to PDFs
If you decide to have attachments in search results (by indexing the attachment post type), by default the links in search results pages will lead to the attachment page. That’s often less than helpful, as it’ll take one more click to reach the actual PDF. Enabling this option will make the search results pages link directly to the PDF file.

Searching

Searching tab

Default operator
OR search will return all posts where at least one of the search terms appears. AND search will only return posts that have all search terms in them. OR search will prefer posts that have all search terms in them, so in most cases it is the better option.

Fallback to OR
If you have chosen AND as the default operator and the search finds no results, Relevanssi will perform an OR search with the same search terms. If you want to disable this, check this option.

Default order
By default Relevanssi orders results by relevance, trying to put the most relevant results first. This makes a lot of sense. Some people prefer other methods. From the settings page, you can choose post date order, most recent posts first. If you want other orderings, you can use the orderby parameter. For multiple levels of ordering, Relevanssi supports array orderby.

Keyword matching
Relevanssi can match whole words or partial words. Matching whole words means only complete words are matched. If you search for “ledge”, you will only find documents that contain the word “ledge”. Partial words also matches parts of words, so searching for “ledge” will also finds documents that contain words “knowledge” and “ledger”.

The search term has to be either in the beginning or the end of the word, so searching for “ion” will find “caution” or “ionized”, but not “cautionary”.

Weights
Here you can adjust weights for different features like post titles, tags, comments, different post types or taxonomies. Some of these adjustments are Premium only. All the weights work the same way: they are multipliers, so 1 keeps the weight neutral compared to everything else, below 1 makes the weight smaller and values over 1 make the particular item weigh heavier in the matching.

If you want to emphasize something, don’t be afraid of using big numbers. If you want to make sure that posts with the search terms in titles come up in the search, slap a weight of 100 or 1000 for the titles. Subtlety is overrated.

Recent posts bonus cutoff
If you’ve added extra weight for recent posts, this option determines which posts are considered recent.

Admin search
If you enable this option, Relevanssi will be enabled for admin searches. Otherwise default WordPress search will be used in all searches in the admin interface. Admin searches may not always work very smoothly. For example page search will not use Relevanssi, because that’s just how WordPress works.

Respect exclude_from_search
If you check this option, custom post types which have exclude_from_search set to true will be excluded from the search. If the option is unchecked, Relevanssi won’t respect that setting and will search anything that is indexed.

Throttle searches
On large sites searches can become heavy to process, particularly when there are common words involved. Relevanssi has to load every post that is found by any search term, and that can require lots of memory. In most cases, the user only cares about the few posts on the first page of search results.

This option will restrict Relevanssi to only first 500 posts per search term. Relevanssi will only take the first 500 posts per search term, so the maximum number of posts Relevanssi will load in memory is 500 times the number of search terms. The 500 posts are chosen with some sense, so it is very likely the best posts are within those 500 posts. This way the search becomes more effective and less memory-intensive. On a small site this option isn’t necessary – if a single search term finds less than 500 posts, the limit of 500 doesn’t make any difference – but on a large site this is very useful option, and I recommend you use this option all the time.

Do note that choosing the probably best posts only works with the relevance ordering. If your order posts by date, it is quite likely the limit will drop out useful posts. If you need to have the limit and you want posts ordered by date, I suggest you set Relevanssi to relevance order, use a limit and then use orderby parameter to sort the results by date.