Partial MatchWIP

Help users find what they’re looking for by returning search results that partially match keywords in their query

Example for Partial Match

Introduction

By default, Miso’s Search engine returns products or content based on matching of all keywords. For example, if a customer shopping for shoes searches β€œblue Nike dunk low”, only products containing all four keywords: β€œblue”, β€œNike”, β€œdunk”, and β€œlow” would be returned. This can lead to highly relevant search results but also risks returning few results or an empty page if the product catalog doesn’t have exactly what the customer is looking for.

By using Partial Match, you can relax the search criteria to return products that only match some of the search keywords, thereby increasing the search recall.

The following steps assume you have already set up an engine for Search. If not, head over to the Quickstart guide to get started.

Do it with APIs

To enable Partial Match within Miso’s Search API, simply set the enable_partial_match parameter to true in the request body.

Additionally, you can modify the response by setting values for partial_match_mode and enable_partial_match_threshold:

partial_match_mode

Choose from blended (default) or separated.

  • Blended: When partial_match_mode is blended, keyword-matched items and semantically-matched items will be returned in the same, rank-sorted array.
  • Separated: When partial_match_mode is separated, keyword-matched items will be returned in a products array and semantically-matched items will be returned in a partially_matched_products array. A scenario where this is useful is if you only want to show semantically-matched products when the keyword-matched products are out of stock or not in your product catalog.

enable_partial_match_threshold

If partial_match_mode is set to separated, you can optionally provide a value for the partial match threshold. This parameter, which accepts an integer , informs Miso’s Search Engine when to provide partially matched results. For example, if we set "enable_partial_match_threshold" : 3 , partially matched results will only be returned when there are three or fewer exact keyword matches. By default, the partial match threshold is set to 5.

Let’s revisit our earlier example of shopping for shoes. Suppose we have a product catalog with the following items:

sneakers.png

Without partial match enabled, if a user searches for β€œblue Nike dunk low”, a single product from the catalog would be returned, since only β€œNike Dunk Low β€˜University Blue’” matches all four keywords: β€œblue”, β€œNike”, β€œdunk”, and β€œlow”.

Request:

POST /v1/search/search
{
"q" : "blue Nike dunk low",
"user_id" : "user-123",
}

Response:

{
"data": {
    "products": [
            {
            "title": "Nike Dunk Low - University Blue"
            }
    ],
    "total": 1
}

Now let’s enable partial match, set the partial match mode to blended, and set the threshold to 5. In our example there is only one exact match, so we should expect to see partially matched products in a separate array. The partially matched results are ordered by relevancy to the user.

Request:

POST /v1/search/search
{
  "q" : "blue Nike dunk low",
  "user_id" : "user-123",
  "enable_partial_match" : true,
  "partial_match_mode" : "separated",
  "enable_partial_match_threshold" : 5
}

Response:

{
"data": {
    "products": [
        {
        "title": "Nike Dunk Low - University Blue"
        }
    ],
  "total": 1
    "partially_matched_products": [
        {
            "title": "Nike Dunk Low - Goldenrod",
            "_missing_keywords": ["1"]
         },
        {
            "title": "Nike Dunk High GS - White Midnight Navy",
            "_missing_keywords": ["2"]
        },
        {
            "title": "Yeezy Boost 350 V2 - Dazzling Blue",
            "_missing_keywords": ["3"]
        }
    ]
}

Now we are returning three additional products that share keywords with the search query and are likely to be relevant to the user.

Tips and Tricks

  • Before implementing partial match via API, you can visually preview the results with Dojo. Open the Advanced Settings pane in the Search Engine Sandbox and enter an integer value in the β€œENABLE_PARTIAL_MATCH_THRESHOLD” box to get started.

Partial Match Dojo

  • To return a broader set of products that are related to the search terms, enable the semantic search parameter to have Miso’s search engine perform semantic analysis on the user’s query. For more information, see the Semantic Search recipe.

Additional Resources

For more information on Miso’s Search API, check out the official API Documentation.

For more recipes like this, visit the Recipes page on our Docs site.

Published Date: March 17th, 2022

API Reference

πŸ’»

Need more info on the API? Check out our dedicated API page with all the info you could ever want.

Read API Reference
Icon/Activity Icon/Add Icon/API Icon/Arrow/Down Icon/Arrow/Left Icon/Arrow/Right Icon/Arrow/TopRight Icon/Arrow/Up Icon/Bento Icon/Billing Icon/Bin Icon/Book Icon/Bookmark/Default Icon/Bookmark/Filled Icon/Calendar Icon/Caret/Down Icon/Caret/Up Icon/Chavron/DownIcon/Chavron/LeftIcon/Chavron/RightIcon/Chavron/UpIcon/Checknox/CheckedIcon/Checknox/Unchecked Icon/Checklist Icon/Chip Icon/Clipboard / Copied Icon/Clipboard/Default Icon/Clock/Stopwatch Icon/CMD Icon/Data/Catalog Icon/Data/Engine Icon/Data/Group Icon/Data/Interact Icon/Data/Users Icon/Dive Icon/Docs/Key Icon/Dojo Icon/Email Icon/Env/Development Icon/Env/Playground Icon/Env/Prod Icon/Folder Icon/Fullscreen/Collapse Icon/Fullscreen/Expand Icon/Guides/Multiple Icon/Guides/Single Icon/Hashtag Icon/Heart/Outline Icon/Heart/Solid Icon / Cart z Icon / Click Icon / Clock Icon / Data Icon / Doc Icon / EmptyCart z Icon/Social/Facebook Icon / Genome Incognito Icon / Money Icon/Social/ProductHunt Icon / Search Icon/Social/Twitter Icon / User Icon/Info/Error Icon/Info/Info Icon/Info/Question Icon/Info/Warning Icon/Interact/Download Icon/Interact/Edit Icon/Interact/External v2 Icon/Interact/External Icon/Interact/Filter Icon/Interact/Logout Icon/Interact/Options Icon/Interact/Re-order Icon/Interact/Reload Icon/Interact/Remove Icon/Interact/Replace Icon/Interact/Search Icon/Interact/Shuffle Icon/Interact/Undo Icon/Interact/Upload Icon/Interact/Video Icon/Invoice Icon/Loading Icon/Loading Icon/Lock/Locked Icon/Lock/Unlocked Icon/Lock Icon/Mapping Menu Icon/Notification Icon/Overview Icon/Person/Team Icon/Person/User Icon/Plan/Enterprise Icon/Plan/Growth Icon/Plan/Startup Icon/Plan/Trial Icon/Recipe Icon/Rocket Icon/Settings/App Icon/Settings/User Icon/Settings Icon/Shrine Icon/Sidebar/Close Icon/Sidebar/Open Icon/Slideout Icon/Sort/Ascending Icon/Sort/Default Icon/Sort/Descending Icon/Star/Filled Icon/Star/Outlined Stopwatch Icon/Support Icon/Tag Icon/Interact/Thumb/Dislike Icon/Interact/Thumb/Like Icon/Tick Icon/Trend/New Icon/Trend/Trending Icon/Tutorial Icon/Lock/Unlocked Icon/View/Grid Icon/View/List Icon/Watchlist/Add