Safe Search

With Miso Safe Search, automatically filter age-restricted items from appearing in your search results, unless explicitly searched.

Example for Safe Search

Introduction

If your e-commerce site has a diverse catalog, including age-restricted items such tobacco, alcohol, and sexual health products, you may not want those age-restricted items to appear in product search results, unless explicitly searched.

For example, suppose a customer searches for “cinnamon” on a grocery site and sees the following search results:

safesearch_cinnamon.png

Although all three items technically match the search criteria, it’s likely that the user’s intent is more “family-friendly” and that they don’t want to see alcohol in the search results. However, if the user had explicitly searched for “cinnamon whisky”, it would make sense for the Fireball product to be shown.

In this article, we’ll discuss how Miso’s Search Engine can be fine-tuned to allow for context-switching between “family-friendly” and “adult” products.

Do it with APIs

Before enabling Safe Search on your site, we require that your products’ categories be recorded in the product catalog. For more information on product categories, see our Product / Content Upload API documentation.

To enable Safe Search on your Search Engine, you will need to provide your Miso Support team with a .csv file containing a list of categories that contain “adult” products. And stay tuned - Safe Search management is an upcoming update to Dojo.

Next, set the enable_safe_search parameter to true in your API request body.

From our previous example, a customer searches for “cinnamon”, but with Safe Search enabled, only products in the “pantry” and “breakfast” category are returned.

//Sample Request
POST /v1/search/search
{
    "q" : "cinnamon",
    "user_id" : "user-123",
    "enable_safe_search" : true
}

//Sample Response
{
    "data" : {
        "products" : [
            {
                "product_id" : "mccormick_grnd_cinnamon"
                "categories" : ["Pantry", "Spices and Seasonings"]
            },
            {
                "product_id" : "pillsbury_cinnamon_rolls_original"
                "categories" : ["Breakfast", "Donuts and Pastries"]
            },
            {
                "product_id" : "kellogg_pop_tarts_cinnamon"
                "categories" : ["Breakfast", "Donuts and Pastries"]
            }
        ],
        "total" : 10
    }
}

On the other hand, if the customer searches for “cinnamon whisky”, they will see the relevant product, even with Safe Search enabled.

//Sample Request
POST /v1/search/search
{
    "q" : "cinnamon whisky",
    "user_id" : "user-123",
    "enable_safe_search" : true
}

//Sample Response
{
    "data" : {
        "products" : [
            {
                "product_id" : "fireball_hot_cinnamon_whisky"
                "categories" : ["Beer, Wine, and Liquor", "Spirits and Liquor"]
            }
        ],
        "total" : 1
    }
}

Additional Resources

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

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

Published Date: April 1st, 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