Adding a Search API Page
Last updated on
28 January 2022
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
- Make sure the Search API Pages module is enabled.
- Go to the Search API administration page at Administration > Configuration > Search and metadata > Search API (or
http://example.com/admin/config/search/search-api
). - Go to the "Search pages“ tab.
- Click "Add search page“.
- Fill out the form.
- Search name
- This will be the page title displayed to the user when she accesses the search, so this should be chosen carefully and with the user in mind. It can be changed later, however.
- Index
- The index this search will be based on. This will of course define which items will be found by searches on this search page. This option cannot be changed afterwards.
- Enabled
- The search page will only be accessible to users if it is enabled. Only search pages on enabled indexes can be enabled.
- Search description
- A description displayed to users above the search form. Can be left empty, and can later be changed. The description cannot contain HTML, but lines will break automatically as entered.
- Path
- The menu path at which the search page will be accessible. Specify a path relative to the root of the Drupal installation, and don't precede it with a slash ("/“).
- Click "Create page". You will be taken to a second form, with detailed settings on how the search is executed and how results will be displayed.
- Query type
- This determines how the keywords entered by the user will be parsed and handed to the search backend. "Multiple terms“ is usually what users will expect.
- Multiple terms
- Searches for items containing each of the entered words (where words are separated by white-space). E.g., blue bike will search for items containing both the words "blue“ and "bike“, not necessarily next to each other.
Quoting phrase with double quotes is possible: red "blue bike" will find items containing the word "red“ and the phrase "blue bike“. - Single term
- Will find items which contain the keywords as a phrase, exactly as entered.
- Direct query
- Hands the search keywords directly to the search server, unparsed. How this query type is handled therefore depends on the server used, and should be explained in the service class' documentation.
- Searched fields
- Here you can limit the fulltext fields which will be searched for the keywords.
- Results per page
- The number of result items displayed per page.
- View mode
- If the item type stored in the index allows it, you can select the way the results are rendered here. Select "Themed as search results“ to get a default generic theming of results, which might, e.g., also contain a highlighted search excerpt, if the server supports it.
- Enable spell check
- This option will only appear if you have the Search API Spellcheck module installed and enabled, and if the server used supports this feature. When this is enabled and a user enters a misspell keyword, a "Did you mean: …?“ note will appear above the search results.
- Click "Create page“ to finally save the page and be taken back to the overview.
- Add a menu entry pointing to the new search page, so users will find it.
- You should also test your new search page to see whether everything works as expected.
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion