Note
The following information on creating search pages is for Drupal 7 and the Apache Solr Search module only. If you are using the current Drupal version and Search API, see the Search API documentation on Drupal.org.
A search page displays search results to your website visitors. The Apache
Solr Search module comes with a search page already configured, with a
path of /search/site
. You can configure the default search page, or
create other search pages or blocks, using the Apache Solr search
> Pages/Blocks configuration page. You can use different search pages
and search blocks, each of which you can design and configure to
present the right search results with the right style for the context.
For example, you can create different search pages for the following
situations:
You have several search environments and, on occasion, you want a multisite search and in others you want to present results from one search environment.
You want to exclude some content types in some contexts, but include them in other contexts.
You want to display content from a specific bundle (for example, blogs or webinars).
You want to have separate sections in your website with separate search behavior or themes.
To create a new search page, click the Add a search page link, or copy an existing search page by clicking the Clone link under Operations.
To configure an existing search page, click the Edit link.
Configuring a search page
Every search page, like every Drupal page, needs a label and description identifying it in the Drupal content administration pages. A description helps identify how the search page must be used.
Under Search Page Information, you can configure:
Search environment: If you don’t specify a search environment, the search page will be disabled. If you only have one search environment, specify Acquia Search. For more information, read Using multiple search indexes.
Title: The HTML title the browser displays. You can use the variable
%value
to include the search term in the title. For example, if you set the search term title toSearch results for %value
and the user searches forGold
, the search page will display the title Search results for Gold.Search type: If you are filtering on a value from the search path, you can specify the search type.
Path: The path for the search page. Search keywords will display as query arguments at the end of the path.
Configuring custom filters
Your search page can use custom filters to apply to all searches. Select Custom filter, then enter one or more comma-separated filter queries to apply by default. For example, you can filter your search pages to return only blog content with the following custom filter:
bundle:blog
Custom filters use Lucene query syntax. For information about Lucene query syntax, read Apache Lucene - Query Parser Syntax.
Configuring advanced search page options
Under Advanced Search Page Options, you can configure:
Results per page — The number of search results to display on each page of the search results.
Enable spell check — Offer spelling suggestions in a
Did you mean...?
message displayed above the search results.Enable the search box on the page — Display the search box on the page.
Allow user input using the URL — You can allow users to manually facet the search results using query parameters in the URL (for example,
example.com?q=test&fq=userinput
). This works for users only after they have executed a search using a search term. Acquia recommends you don’t enable user input.
Configuring behavior on empty search
Under Advanced Search Page Options, you can configure how the search page behaves when a search does not return any results. If you have enabled the Facets API, you can select one of the following:
Show search box
Show enabled facets’ blocks under the search box which is the default behavior, if you have enabled the Facets API
Show enabled facets’ blocks in their configured regions
Show enabled facets’ blocks in their configured regions and first page of all available results
For more information, read Filtering search results.