Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@blaze-cms/plugin-search-ui

Package Overview
Dependencies
Maintainers
11
Versions
317
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blaze-cms/plugin-search-ui

Blaze plugin search ui

latest
npmnpm
Version
0.144.0
Version published
Maintainers
11
Created
Source

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.

FAQs

Package last updated on 11 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts