The primary way to configure SearchWP is using the Engines tab of the SearchWP Algorithm screen:
To edit the settings for an Engine, click the Source & Settings button for that engine. A dialog will be presented to you:
Note: The Default Engine is special in that it is the Engine that will be used for native WordPress searches.
As a result, the only enabled Sources for the Default Engine are Post Types (e.g. Posts, Pages, Custom Post Types). A supplemental Engine can include any Source.
Using this dialog you can pick and choose which Sources will be included in search results for this Engine. Further you can:
- Determine whether keyword stems should be considered
- Designate the Engine as the one to use for searches in the WordPress Admin
Each SearchWP Engine has a collection of Sources. A Source is an “indexable” type of content on your site. An Engine will include results only from the Sources which have been added to it.
Each Source in turn has its own settings – Attributes and Rules.
- Types of content within each Source, e.g. Title, Content, Custom Field, Category, Tag, etc.
- Control whether entries are returned or not based on your defined criteria.
Using Attributes and Rules you can customize your Engine to do exactly what you want!
Each Source within a SearchWP Engine has its own unique set of Attributes. You can pick and choose which Attributes are considered during searches for each Source within each Engine by clicking the Add/Remove Attributes button for that Source.
For example, when considering Posts, the following Attributes are made available:
Once you’ve decided which Attributes you’d like to consider, each can be given its own relevance weight by adjusting the slider. By default there are three slots on the slider. The further right the slider, the more weight that particular Attribute will be given in the search algorithm.
Note: Adjusting weights can be done at any time without needing to rebuild the index. Application of these values is applied as searches are run. There may be a time where customizing the Attributes for a Source necessitates that the Index be rebuilt. SearchWP will notify you when that happens.
As is the case with Attributes, Rules can be applied per Source per Engine, allowing you to define what should (or should not!) be returned as results. Some example restrictions include:
- Exclude entries in a certain Category
- Only show entries published within the past 6 months
- Limit Media to a file type
Clicking the Edit Rules button allows you to define the circumstances under which entries should (or should not) be returned.
There are some things to note when it comes to setting up your Rules:
- Rules are grouped using conditions either by
- Within Rules each condition is evaluated alongside the next using
ORlogic, meaning any condition can be met.
- When multiple Rules are added, the set of rules is evaluated using
ANDlogic, meaning all Rules must be satisfied in order to take effect.
Given this setup, you will need to be mindful of the way you are setting up your Rules and conditions. If something seems impossible it may be worth trying a new combination of