UpStart Commerce Search
Semantic (Neural) Search
Using Semantic (Neural) Search
3min
to use neural search, you'll need to send a specific query to the upstart commerce api here's an example of how to structure your query curl location 'https //nochannel dev 1 api nochannel dev upstart team/v1/search/routes/catalog live/search' \\ \ header 'content type application/json' \\ \ header 'x upstart tenant your company' \\ \ header 'x upstart api key your api key here\\ \ data '{ "search" { " source" { "excludes" " knn" }, "query" { "nested" { "path" "dynamicproperties neural description catalog model embedding", "query" { "neural" { "dynamicproperties neural description catalog model embedding knn" { "query text" "summer outfit", "model id" "catalog model", "k" 10 } } } } } }, "mostvaluablequery" { "query" "summer outfit" } }' key components of the query source excludes this section defines the search fields you want to exclude it is recommended when searching on an index with vectors to exclude knn fields since those are the ones that contain vectors vectors will still be searched through but not returned by the search response as they have no use on a storefront this will make the search query faster and the response smaller nested query when using neural search a neural query within a nested query needs to be used all the time to search through all the vectors and not miss data parameters path path to the field containing all the vectors query query to be used with neural query in neural search it will always be “neural” neural query parameters dynamicproperties neural description catalog model embedding knn this is the field the query will search on it represents the vector embedding of the product description, which has been processed by the catalog model to create a semantic representation of the text model id "catalog model" this specifies the machine learning model to use for the neural search in this case, it's using the "catalog model" model, which is designed for catalog search k 10 this parameter determines the number of results the neural query will return in this example, it will return the top 10 most relevant results based on the neural search mostvaluablequery query internal query value used for search query rules example use case apparel store let's say you run an online apparel store a customer searches for "breathable workout gear " with neural search the system understands the intent (exercise clothing that allows airflow) it searches for products with relevant attributes, even if they don't explicitly use the words " breathable " or " workout " the results might include moisture wicking t shirts, ventilated running shorts, and lightweight training shoes these results are then ranked based on their relevance to the query's meaning