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.

Using Tags

Tags provide a useful way to group related posts together and to quickly tell readers what a post is about. Tags also make it easier for people to find your content. Tags are similar to, but more specific than, categories. The use of tags is completely optional.

For more information on the differences between tags and categories please check out this support doc.

Depending on the theme and widgets you have activated, tags can be displayed at the top or bottom of posts, on the individual post view, and/or in the sidebar. You can assign multiple tags per post.

Adding Tags via the Tags Metabox

You can assign and/or add new tags to posts before you publish them using the Post Tags module to the bottom right of the post editor:

You can add tags one at a time by clicking on the highlighted tag or hitting the Enter/Return key on your keyboard after typing each tag. Or you can add multiple tags at a time by separating them with a comma as you type.

To remove a tag from the post, click the small X icon next to the tag.

To choose from your most commonly used tags, click Choose from the most used tags. Then, click on the tags you want to assign to the post.

 

Adding Tags via the Dashboard

You can add new tags and manage existing ones from Posts -> Tags in your dashboard.

You will be presented with a list of your existing tags and a method of adding new tags.

You can add a new tag by filling out the fields:

  • Tag name – As expected, the name of your tag.
  • Description – Describes what the tag is for. This may be displayed in certain themes as, for example, a tooltip (shown when you hover over the tag).

Managing Tags

The Posts -> Tags page in your dashboard shows a list of tags you’ve used, as well as the name and number of posts belonging to each tag. If you move your mouse over a tag a set of options will appear allowing you to edit, quick edit, or delete that tag:

If you click on Quick Edit the tag will change into an edit box and you can rename the tag quickly:

If you click on Edit you will be taken to a separate page where you can edit the name and description. This functions exactly the same as adding a tag.

Clicking on Delete will delete that tag.

Bulk Actions

If you have a lot of tags that you want to delete, you can use the bulk actions feature. Select each tag you want to delete using the checkbox to the left of the tag name.

If you want to select all tags click the checkbox at the top:

From the bulk actions menu select Delete and then click Apply. The tags will be deleted.

 

Using Categories

Categories provide a helpful way to group related posts together, and to quickly tell readers what a post is about. Categories also make it easier for people to find your content. Categories are similar to, but broader than, tags. For more information on the differences between categories and tags please check out this support doc.

Depending on the theme and widgets you have activated, categories can be displayed at the top or bottom of posts, on the individual post view, and/or in the sidebar. You can assign multiple categories per post (you must assign at least one), and categories can be organized hierarchically.

Adding Categories via the Categories Metabox

You can assign and/or add new categories to posts before you publish them using the Categories metabox to the right of the post editor:

Select the checkbox next to a category name to add it to a post.

  • If you would like to add a new category to your blog and associate it with the post, click + Add New Category.
  • Click the Most Used tab at the top of the module to select from your already created categories that you use the most.
  • Use the Parent Category drop down menu to nest a category within a category.

Adding Categories via the Dashboard

You can also add new categories and manage existing ones from Posts -> Categories in your dashboard.

You will be presented with a list of your existing categories and an option to add new categories.

You can add a new category by filling out the fields:

  • Category name – As expected, the name of your category.
  • Category slug – The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.
  • Category parent – If you want to nest a category within a category, select the parent category. Otherwise leave atNone.
  • Description – Describe what the category is for. This description will appear as a tooltip if you use the category widget. (Optional)

Managing Categories

The Posts -> Categories page in your dashboard displays all your categories and shows the name, description, and number of posts belonging to each category. If you move your mouse over a category a set of options will appear, allowing you to edit, quick-edit, or delete that category:

If you click on Quick Edit the category will change into an edit box and you can rename the category quickly:

If you click on Edit you will be taken to a separate page where you can edit the name, parent, and description. This functions exactly the same as adding a category.

Clicking on Delete will delete that category. When a category is deleted, all posts that were only in that category will be assigned to the default category. If a post was also in other categories it will remain untouched.

Note: You cannot delete the default category, but you can change the name and URL slug.

Bulk Actions

If you have a lot of categories that you want to delete, then you can use the bulk actions feature. Select each category you want to delete using the checkbox to the left of the category name.

 

If you want to select all categories, click the checkbox at the top:

Once you have selected the categories you want to delete, select Delete from the Bulk Actions menu, and then clickApply. The categories will be deleted. When a category is deleted, all posts that were only in that category will be assigned to the default category. If a post was also in other categories it will remain untouched.

Setting the Default Category

A default category (uncategorized) will be assigned to published posts if you don’t specify one. The default category can be changed under Settings -> Writing in your dashboard.

 

Using Post Categories and Tags

Categories and tags are used to make it easier for your users to navigate your website. Used correctly, they can increase your website’s overall usability.

Each post must have one Category, but it’s up to you whether you have Tags or not.

Some good advice is that your Categories are like your site’s table of contents, and your Tags are for your site’s index.

Categories

Categories is a hierarchical taxonomy. This means that you can create a tree structure, with parent categories and child categories.

For example, if you had the Recipes Category, you could have children such as Starter, Main Course, and Dessert.

Tags

Tags are a non-hierarchical taxonomy. This means that there are no parents and children, but the information is presented as flat. A post in the Dessert Category might have the tags baking, chocolate, cake, fruit, and nuts.

If you’d like to learn more about Categories and Tags, and how they work, you can read all about Taxonomies in the WordPress Codex.