Core SearchWP Sources (Posts, Pages, Media, Comments, CPTs)
By default SearchWP will make searchable all post types (e.g. Posts, Pages, Custom Post Types, Media) and Users. In addition to the post types themselves, each post type has a number of Attributes, including:
- Title
- Excerpt
- Slug
- Content
- Custom Fields
- Taxonomies
- Comments
When setting up your Engine(s) you can pick and choose which of these Source Attributes are added to each Engine and SearchWP will index and weight those Source Attributes based on the configuration you specify.
Note: All listed Sources in an Engine will be indexed and searchable. All listed Attributes within each Source will be indexed and searchable. You can remove any Source or Attribute by un-ticking the checkbox when configuring your Engine(s).
SearchWP can also index additional custom database tables by way of \SearchWP\Source
. There are some officially supported custom Sources available as Extensions and you can write your own as well.
Types of Attributes
There are two types of Attributes for SearchWP Sources: standalone Attributes and Attributes with Options. Standalone Attributes include Title, Excerpt, and Slug. Each standalone Attribute can receive a unique relevance weight.
There are also Attributes with Options, which include Custom Fields and Taxonomies. Each Attribute Option (e.g. individual Custom Fields, Taxonomies) can each receive their own unique relevance weight.
Comments
Comments are treated in a unique way in that they are essentially a sub-Source because they are directly tied to a post type (e.g. Posts).
When Comments are added to an Engine, they can be configured to search Comment-specific Attributes (again each with a unique relevance weight) but the calculated relevance weight will be transferred to the parent WP_Post
(e.g. Post, Page, Custom Post Type).
Comments are managed as a separate Source so as to minimize the work SearchWP has to do to keep the index updated as Comments are added/removed/edited.
Comments are not made searchable by default, and until Comments are added to an Engine they will not be indexed.