Creating a Search Index
First, create an index. Indexes are used to quickly locate data without having to search every row in a database table every time a database table is accessed. An index is used to define which fields of the database table you want to search. You can even build multiple search indexes on the same table to build different search criteria. For example, if you have both public and private data in the same table, you can build a “normal user” and an “administrator” search. To create an index, click Indexes at the top of the table you would like to build search for, and then click Create Index.

An example of creating a search index.
Building a Search API
After generating the index, it can be implemented it into a query in the function stack. Use the Custom Query feature in the Filter tab of the Query All Records function. When adding a custom query, the newly created index is available in the expression builder, noted by the $ symbol. It is also labeled as search underneath the name.
Look for the $ symbol as well as the word search to easily find your search index when configuring your query.

Setting the operator to Search and specifying our search query.
Ranking
You can implement a ranking system and sort the search results by this rank for more precise search results. To do this, go to the Output tab of the Query All Records function, add an eval on the search index, and apply the search_query filter. This tells Xano to “use my search index to generate a ranking score of my results based on my search query”.
Create and Eval on the search index by applying the search_rank filter so we can sort by ranking.
Add a Sort to the Query by clicking on the Return portion of the Output tab.

Order by in descending order will provide the most relevant search results first.
Different Search Methods
Search queries can be written in different ways to fulfill specific search requirements.-
Words separated by a space imply an AND.
Example: A query of “toy story” means search for toy AND story -
Exact phrase searches are possible using double quotes.
Example: If you wanted to search for “Toy Story” as an exact match, your query would be “Toy Story” with the quotation marks. Note: if you are entering this search expression directly into a JSON payload, then you may need to escape the quotes with a backslash. example:{"search": "\"Toy Story\""}
-
Partial phrase matching
Example:"Toy * Story"
would return any results that contain Toy Story with one word in between."Toy *** Story"
would return any results that contain Toy Story with three words in between. -
Wildcard matching
Example:Sto:*
would return any results that contain words that start with sto. -
Expression groups
Example:(Woody or Buzz) Toy
would return multiple matches for the word Toy that also include either Woody or Buzz. -
Negation of specific words is possible by using a - character.
Example: If you wanted to search for movies that have Toy in the title, but not Toy Story, your query would be"toy -story"
. -
You can also use a combination of these to get even more specific.
Example: Searching for"toy story" day -night
would mean search for the phrase Toy Story and the word day, without the word night. -
Priority targets allow you to specify which priority defined in your search index to use for the specific expression. This can be combined with wildcard matching as well.
Example:Toy Story:2
would search for all records containing the word Toy, as well as the word Story in any fields representing priority 2 in your search index.
Example:Toy Sto:*2
would search for all records containing the word Toy, as well as words starting with Sto in any fields representing priority 2 in your search index. -
Single vs Plural is supported.
For example, “toy” will also return results that contain “toys”.
For example: is, and, an, or, the. Stop words are not included in your search query.
Search Results
Search results are returned just like any other API response and the data works just like any other variable inside Xano.