Homepage

Keyword Match Type

Last edit: Jan 25, 2024

Warning

This article promotes customizations, listings and people GraphQL queries, which are deprecated due to the limited configuration option. To leverage the power of ElasticSearch, we recommend using JSON Documents, which allows you to define your own ElasticSearch mapping and have full control on what gets stored in the ElasticSearch.

Search by default tries to match the keyword exactly with the words in the field. When you search for alan it will match values alan, but also Mike Alan and Mike Alan and Tommy. You can also define a keyword to match words that start or end with the given phrase.

Match type

For example, you want to search users whose name starts with Al:

query search_people {
  people(query: { keyword: "Al", match_type: ENDS_WITH }) {
    results {
      name
    }
  }
}

Returns users that have name starting with Al*, e.g. Alex, Alan, Alice.

The query argument takes an optional match_type parameter when no specified EXACT is set.

  • EXACT: The keyword "alpha" matches "alpha" OR "alpha gamma" OR any sentence containing exact "alpha" word, This is the default behavior.
  • STARTS_WITH: The keyword "alp" is shortcut for "alp*" and matches "alpha" "alphabet", and any sentence containing any word starting with "alp".
  • CONTAINS: The keyword "alp" is shortcut for "alp" and matches "alpha alphabet somealpha".
  • ENDS_WITH: The keyword "alp" means "*alp" and matches "scalp".

Wildcards

Keyword also accepts the wildcards, ? for a single character, and * for more. For example:

  • al*r* will match alexander, alexandra, but not alex
  • al?n will match alan, alen, but not aleen

Questions?

We are always happy to help with any questions you may have.

contact us