@blaze-cms/plugin-search-ui

0.144.0 • Public • Published

Base search plugin ui

This plugin is creating a modal interface for blaze admin and also a searchbar (for client-side) boat are consuming an ELK (Elastic search) API to be able to find any field in the content already created.

Query

To do that we are passing to the SearchAdmin query an speciall variable rawQuery (same with search published content query). This raw query is an ELK query composed by the following fields:

  • query: Returns documents based on a provided query string, using a parser with a strict syntax.
  • fields: Allow you to find in multiple fields. In our case there are not anyone set.
  • minimum_should_match: That matches documents with at least two of the terms that are set in query. Imagine that you have set in query 'this, that or thus' then will match if there are at least of two of this words.
  • type: 'cross_fields': The cross_fields type is particularly useful with structured documents where multiple fields should match. For instance, when querying the first_name and last_name fields for “Will Smith”, the best match is likely to have “Will” in one field and “Smith” in the other.

Also at the end of te query value we added a wildcard in order to do a partial matches. For example if I would like to search all the names that contains da, the results could be adam, david because is matching partially with those names.

rawQuery: {
  query_string: {
    query: <value>*,
    fields: [],
    minimum_should_match: 2,
    type: 'cross_fields'
  }
}

Filter

We have added a filter in order to be able to filter among which entities (pages, articles...) would you like to focus your search. To do that we are accepting the filter variable into te query which has the following format:

{
  filter: [
    {
      terms: {
        docType: filter
      }
    }
  ];
}

Advanced seaches

Imagine that you know in which field is the value that you would like to search. For example in a metakeyword field. Then you could add to the query the following value: metakeyword:myKeyword just to search in every field metakeyword the value myKeyword.

Readme

Keywords

none

Package Sidebar

Install

npm i @blaze-cms/plugin-search-ui

Weekly Downloads

183

Version

0.144.0

License

GPL-3.0

Unpacked Size

333 kB

Total Files

131

Last publish

Collaborators

  • ismael_haytam
  • emcleandev
  • tanane
  • daoyong
  • marekb9
  • mcabrerapf
  • jan_byte9
  • grzegorzi
  • andypail
  • ishrat
  • adrdilauro