A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.contentful.com/developers/docs/references/content-delivery-api/ below:

Content Delivery API | Contentful

You have available two flavours of full-text search:

How does global full text search work

There are cases where you want to find all the content resources which contain some particular words (search terms) but you don't know from which content type (for entries) or on which field those terms can be, so you can't use any of the field filters. For cases like these full-text search is the perfect tool for the job. With it you can find all the content resources which match your search terms in any of their text and symbol fields.

Full-text search can be used to find entries, assets or content types. For the remainder of this section we will refer to entries but the same principles and restrictions will apply to the other types.

Which content is looked up during a global full-text search?

All text (both regular and rich text) and symbol fields in all the locales in your environment will be looked up when doing a global full-text search.

How is an entry considered a match?

Before we explain how we identify matches to your search terms we have to explain how these terms are transformed before they are sent to the search engine. After the API has received your query, the input string is sanitized (i.e. some special characters are removed), tokenized (i.e. split into it's constituent parts) and normalized (i.e. guarantee that the tokens satisfy certain constrains, e.g. removing XML tags). Then each of the remaining search tokens is suffixed with a wildcard operator, which implies that full-text search at contentful is left-anchored.

When checking if an entry satisfies the search criteria, the search engine tests if all of the search tokens (i.e. the transformed search terms) can be found in any field in any locale in the entry. This means that an entry can be included in the result set due to matches in different fields and different locales or due to a match in just one field in just one locale. There is also no guarantee about the order in which the search terms can appear in the matching entries. A search for modern red house can be matched with entries which have those words in any possible order (e.g. red ... house ... modern, red ... modern ... house, etc.).

All this combined means that when you for example search for my cat is blue, the search engine will find all the entries where there are words starting with my and cat and is and blue:

Check below the phrase full-text search section if you are interested on those entries where the given search terms can only be found in one field and in the same order as in the search input.

Check the full-text search on a field section if you are interested only on those entries where the given search terms are in only one field.

Phrase full-text search

By default full-text search queries will take the search tokens and find all those entries where the tokens can be found in any field, in any locale and in any order. There are however cases where you might need a more restrictive search strategy and only get those entries where the matches are in the same order as you specificed in the search and in only one field. To achieve this you can wrap the search terms in double quotes (") to enable phrase search.

When you for example search for "my cat is blue", the search engine will find all the entries where the words my, cat, is and blue are found in that order in one field:

If you wish you can combine phrase search with the default full-text search behaviour. This can be useful to refine even more the result set. For example a search like "my cat is blue" summer london will match all those entries where the term "my cat is blue" can be found in just one field in one locale and where the terms summer and london can be found in any field in any locale present in the entry (including the field where the phrase was matched).

Other considerations about full-text search

For more tips on using full-text search, see our Help Center article.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4