Last updated January 13, 2013. Created by queenvictoria on May 24, 2012.
Edited by Kristen Pol. Log in to edit this page.
This documentation is based on D7 with Search API 7.x-1.1 and Views 3. I also happen to be using Fuzzy Search as it allows part of word matching (unlike search_api_db).
Getting started
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.admin/modules
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 viewadmin/structure/views/add
- 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
Filter criteria
- Fulltext search: Expose this filter, Required, Remember the last selection, Use as: search keys
- Indexed Node: Status: Operator: Is one of, Value: Published
Sort criteria
- Search: Relevance, descending (if you don’t have an order with fuzzysearch you will get a PDO exception)
Page settings
- Access: Permission: view published content
Advanced
- No results behaviour: Global: Text area “No results matched your search.”
Exposed form
- 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.