First create a Search server and Search index as per the directions in the previous section. In the index make sure that you enable the status field in order to allow Views to filter on the Published status.
Enable the search_api_views submodule.
I'm going to use the 'Search results' display mode–this means that you won't be configuring which fields are displayed using Views. This is of course at your own personal preference.
Structure > Content types >
[node type] > Manage display > Custom display settings
Enable “search results”
Configure display fields.
Create a new View
Admin > Structure > Views > Add new view
- View name: Search
- Show: [the name of the Search index] (in the case of fuzzysearch the default is "Default fuzzysearch index")
- Create a page [tick]
- Page title: Search
- Path: search
- Display format: Unformatted list of Rendered entity
- Items to display: 10, use pager
Continue & edit (the new View)
Format: Show: Rendered entity | Settings
- View mode: Search results
- Fulltext search: Expose this filter, Required, Remember the last selection, Use as: search keys
- Indexed Node: Status: Operator: Is one of, Value: Published
- Search: Relevance, descending (if you don’t have an order with fuzzysearch you will get a PDO exception)
- Access: Permission: view published content
- No results behaviour: Global: Text area “No results matched your search.”
- Exposed form in block: Yes
- Exposed form style settings: Submit button text: Search
Save the View. Add the exposed form block to a region.
Note that you will only receive results for partial matches that are longer than the minimum word length specified in the Index configuration.