Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Create an advances Search system for Drupal 8 with Search API.

By editor , 18 January, 2017
Question

How to use advances search server like Solr, Elasticsearch, Database ... With a Drupal 8 site ?

Search API and Database Search server.

1. Uninstall drupal basic Search
2. Install search_api and search_api_db
  NOTE : You can also use another database configures on settings.php
3. Add a Search Server (/admin/config/search/search-api/add-server).
  - Use "Database" as cackend server.
3. Add a Search Index (/admin/config/search/search-api/add-index).
  - Select Enteties (Data source) to index with this index and a search server.
  - Save and Add fields to Index. (Example : Title, Body file for "Contents").
  - Optionaly you can configure "Processors" as Filters, Data traitements ...
4. Enable the newly created "Index" then run indexing or queue indexing.
5. Create a view using your Index, and add field "Search: Fulltext search" as Exposed criteris filter.

Once indexing is done, visit the view's page to use the search system.

 

Tips : For a quick start, just install the "Database Search Defaults" (), and configure your "Search Server", "Index" and "Search Pages" on.
 - Search API :        /admin/config/search/search-api
 - Search Views :    /admin/structure/views (Defaut : /admin/structure/views/view/search_content )

NOTE : To create a server like Solr, Elasticsearch you need to install search server and the drupal module for those servers.

 

#Some usefull Drush commands for the search api and facets
#Enable search api
drush pmu search -y
drush en search_api search_api_db -y
#Enable Facets
drush en facets -y
#Index and Re index
drush search-api-index
#OR
drush sapi-i

 

Enable Facets With search API (Example : Db serch)

1. Enable search_api and search_api_db modules
2. Enable facets module for drupal 8
3. Create a Search server and Search Index (at last one search index)
4. Add fields for the index.
    -> Index -> Fields -> "Add field"
5. Create a view to display your search index
6. Create a facet from /admin/config/search/facets -> "add facet" (/admin/config/search/facets/add-facet)
7. Select your facet source (Search view) and Field.
    -> For Tags or entity reference, enable '' and  ''
8. Configure the facet.
NOTE : I got few problems using /search as the search page path.

Now you can see the facets on your search view

Tags

  • Drupal 8
  • Search
  • Module
Solr Configuration for Drupal

Comments

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer