Traditional Search

Exact word matching

Traditional search (exact word matching)

Traditional search results for query "HP DV6-20"Traditional search results for query "HP DV6-20"

Traditional search results for query "HP DV6-20"

Concept

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.

Sample use-cases

  • Searching for reference numbers, IDs, or specific words such as name of a brand (e.g. Nike, Sony)
  • Searching for specific filenames

Sample code

Sample codes using Relevance-AI SDK and Python requests 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-demo'

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.

Sample search result where the traditional search fails due to lack of semantic information.Sample search result where the traditional search fails due to lack of semantic information.

Sample search result where the traditional search fails due to lack of semantic information.


Did this page help you?