1. Search client

VisualSearchRequestResource

VisualSearchRequestResource models the visual search payload used inside SearchRequest.visualSearch for image/text-driven similarity searches. This resource is defined in src/models/search/visual-search-request-resource.ts.

Class structure

  • VisualSearchResource (base) - shared visual-search fields (color, type, imageEntityId, text)
  • VisualSearchRequestResource (request) - extends base and adds image (base64 image hash/string)

Property reference

TS propertySerialized JSON keyTypeDescription
colorcolorstringSelected color filter for visual search context.
typetypeVisualSearchTypeStrategy used to combine vector and text signals.
imageEntityIdimageEntityIdnumberID of the asset used as the visual reference image.
texttextstringAdditional text query prompt to influence results.
imageimagestringBase64 hash/string of uploaded image used as search input.

VisualSearchType values

type VisualSearchType =
  | "vector"
  | "vector+text"
  | "text"
  | "vectorOrText"
  | "vectorAndText";

In practical terms:

  • vector - image/vector similarity only
  • text - text intent only
  • vector+text - combined relevance
  • vectorOrText - broader matching (either signal can match)
  • vectorAndText - stricter matching (both signals should match)

Example use cases

  • Use case: Code
  • Find visually similar assets from an uploaded image:
new VisualSearchRequestResource({
    type: "vector",
    image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
});
  • Hybrid search: image + text intent + color hintTypical use case - a user uploads a reference image and adds text to bias results toward a specific style.:
const visualSearch = new VisualSearchRequestResource({
  type: "vector+text",
  image: "data:image/jpeg;base64,/9j/4AAQSk...",
  text: "minimalist white sneaker",
  color: "white",
});
  • Use an existing asset as the reference imageTypical use case - user starts from an already indexed asset in the DAM instead of uploading a new file.:
const visualSearch = new VisualSearchRequestResource({
  type: "vectorAndText",
  imageEntityId: 123456,
  text: "outdoor product lifestyle",
});
  • Text-first fallback for AI search box behaviorTypical use case - no image available, but still using the same visual-search request shape for text-driven discovery.:
const visualSearch = new VisualSearchRequestResource({
  type: "text",
  text: "blue packaging with geometric pattern"
});
If you have suggestions for improving this article, let us know!