This search looks for the closest answer (most relevant data entry) via exact word matching. Therefore, the best use case for traditional search is when the search result is required to include an exact term within the query string.
- Searching for reference numbers, IDs, or specific words such as the name of a brand (e.g. Nike, Sony)
- Searching for specific filenames
Sample codes using Relevance AI SDK for traditional search endpoint are shown below. Note that as mentioned on the previous page, there is an installation step before using the Python SDK.
from relevanceai import Client dataset_id = "ecommerce-search-example" client = Client() # query text query = "HP DV6-20" traditional_search = client.services.search.traditional( # dataset name dataset_id=dataset_id, # the search query text=query, # text fields in the database against which to match the query fields=["product_name"], # number of returned results page_size=5, )
This search is quick and easy to implement. It works very well in the aforementioned use-cases but cannot offer any semantic search. This is because the model has no idea of semantic relations; for instance, the relation between "puppy" and "dog", or "sparky" and "electrician" is completely unknown to the model. An instance of a failed search is presented in the screenshot below, where the word "puppies" was searched but the closest returned match is "puppet", even though the database includes many entries about dogs and pets.
Updated about 1 month ago