Introducing core search

The admin for search pages can be located by navigating to /admin/config/search/pages. Search pages are part of the core search and metadata that allow both users and content to be indexed and searched based on different factors. If we take a more detailed look, we will note that we can index content, configure minimum word length, and specify which search page to use for our results.

Introducing core search

Indexing content

The most important aspect of search pages is the INDEXING PROGRESS status. Indexing is the process of crawling the site or database, which, in turn, stores a result set that allows content to be found when a user enters a keyword or term in the search form. Unless content has been indexed, we will not have any results to display.

In order to index our site, we need to complete two steps.

  1. First, we must click on the Re-index site button, as shown in the following image:
    Indexing content

    Clicking on the Re-index site button does not perform the actual indexing but merely triggers the indexing to occur.

  2. Second, we must run a cron maintenance task, which can be located at /admin/config/system/cron by clicking on the Run cron button.
    Indexing content

Cron allows specific tasks to run based on a set interval. The interval can be modified by changing CRON SETTINGS. By default, Drupal will run Cron every 3 hours. Cron is triggered when a user first visits the site after the 3-hour period has expired. Cron can also be triggered from a URL outside the site, which allows the manager of the Cron task to be run from the web server itself.

We will not be covering the configuration of Cron from systems administration level. Just know that we can manually run Cron when needed by visiting this page.

After completing the two steps required to index our site, if we navigate back to the search page's admin, we should now see that our INDEXING PROGRESS reports that 100% of the site has been indexed.

Editing search pages

Another configuration within the search pages interface allows us to modify or configure additional settings for the label, URL, and content ranking.

In order to configure our Content search page, we will need to expand the SEARCH PAGES section and click on the Edit button, as shown in the following image:

Editing search pages

The most important configuration option is the CONTENT RANKING section, which allows us to influence certain factors that search uses, including but not limited to Keyword relevance and Number of comments. Content ranking, as shown in the following image, can be modified by changing the value next to each factor.

Editing search pages

A higher INFLUENCE value determines the order of the search results, and modifying this value does not require reindexing the site. For demonstration purposes, we will not change the values on this page.

One important thing to note is that Drupal not only indexes content but also any users that have accounts within the website. Although this is great in order to create member directories, in our case, we only want users to be able to search on content. We can remedy this by disabling users' search pages.

Disabling search pages

From the Search pages admin, if we look under the SEARCH PAGES section, we will see Users currently enabled:

  1. Click on the Edit button for Users.
  2. Click on the Delete link.
  3. Click on the Delete button for complete removal.

We can always create a new Users page at a later time by returning to the Search pages admin. One last step, make sure to reindex the site now that we have removed users and then it's time to move on to review the markup of our Search results page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.235.62