How-to activate and configure the Skeleton search tool

Define filters and analyzers

 

Define copy_to fields

 

Configure the search

{
  "types": [
    "page"
  ],
  "fields": [
    "title_%locale%",
    "all_%locale%"
  ],
  "synonyms": [
    {
      "field": "taxonomies",
      "types": [
        "taxonomy"
      ],
      "search": "all_%locale%"
    }
  ],
  "sizes": [
    20
  ],
  "analyzers": {
    "fr": "french",
    "nl": "dutch",
    "en": "english",
    "de": "german"
  },
  "suggestFields": {
    "fr": [
      "all_fr"
    ],
    "nl": [
      "all_nl"
    ],
    "en": [
      "all_en"
    ],
    "de": [
      "all_de"
    ]
  },
  "filters": {
    "content_type": {
      "type": "terms",
      "field": "_contenttype",
      "optional": false,
      "aggs_size": 50
    }
  }
}

Search route

{
	"controller": "emsch.controller.search::handle",
	"path": {
		"fr": "/fr/recherche",  
		"nl": "/nl/zoek",
		"en": "/en/search"
	},
    "requirements": {
        "_locale": "en|fr|nl"
    }
}

Define a search form

<form class="form-inline my-2 my-lg-0" action="{{ path('emsch_search.'~locale) }}">
  <input class="form-control mr-sm-2" type="search" name="q" placeholder="{{ 'site.search.label'| trans }}" aria-label="{{ 'site.search.label'| trans }}">
  <button class="btn btn-outline-info my-2 my-sm-0" type="submit">{{ 'site.search.submit'| trans }}</button>
</form>

Create a search.html.twig template

{% extends '@EMSCH/template/base.html.twig' %}

{%- block title -%}
    {{ 'search.result.title'|trans }}
{%- endblock title -%}

{%- block body -%}
    <h1>{{ 'search.result.title'|trans }}</h1>
    <div>
        {{ dump() }}
    </div>
{%- endblock body -%}