For the complete documentation index, see llms.txt. This page is also available as Markdown.

Configure semantic search

A guide to setting up semantic search

Beta feature

Semantic search is not generally available yet. Get in touch with your Appfarm contact to discuss early access.

Semantic search finds objects by meaning rather than exact words. For example, a search for how do I reset my password can return an article about recovering account access even if it uses none of those words. This guide sets up a search field in an app that runs a semantic search and lists the results. To match exact words or filter the results, use full-text search instead.

Step 1: Enable semantic search in the data model

In the data model, select the property you want to search. Under Semantic search, select Semantic search. Semantic search can be enabled for String and Rich Text properties. See Semantic search for the full list of requirements.

Each environment has its own search index. The index build starts as soon as the change is deployed to an environment, and changes are deployed to Development automatically. To use semantic search in another environment, deploy the change there. The build processes every existing object in the object class, so on large object classes it can take some time. Semantic search on the property is unavailable until the build has finished.

Step 2: App data for search results and search term

Create a runtime-only data source for the search results, based on the object class that holds the property from step 1. Use cardinality many to return several results. With cardinality one, only the best match is returned.

To show how closely each result matches the search term, add a property with data type Float to the data source, for example a runtime property. It will hold the search score.

Create a String app variable to hold the search term.

Step 3: UI for searching and displaying results

In the UI, bind the app variable from step 2 to a Text edit component. Use the On Enter event handler, or add an adornment icon button and use On Adornment Click, to run the search action described in step 4.

Add a list, table, or iterating container and bind it to the search results data source. To show the best matches first, sort it by the search score property in descending order. Add a visibility condition to tell the user when no results were found.

Add a Semantic search action node to the action from step 3 and set:

  • Data source: the search results data source from step 2.

  • Search field: the property you enabled in step 1. Only properties with Semantic search selected are listed.

  • Search term: the app variable from step 2.

  • Search score (optional): the Float property from step 2.

  • Limit result (optional): the maximum number of results. The default is 10.

Each search replaces the contents of the data source, with the most similar objects first. If the search term is empty, the data source is cleared.

Good to know

If the search runs before the index build from step 1 has finished, the action node fails with an error saying the index is not ready yet. Wait for the build to finish and run the search again.

Was this helpful?