Skip to main content

Personalized Search

Shaped isn't just about recommendations—it's a comprehensive platform for powering all your discovery needs, including search. Whether you're building a simple keyword-based search or a sophisticated personalized search experience, Shaped provides the flexibility and performance you need.

Keyword Search with the retrieve Endpoint

For straightforward keyword matching, leverage Shaped's dedicated retrieve endpoint:

shaped retrieve \
--model-name your-model-name \
--text-query "your-text-query"

Under the hood, Shaped utilizes Tantivy, a blazing-fast, full-text search engine library written in Rust. Tantivy offers several key advantages:

  • High Performance: Built for speed, Tantivy ensures rapid search results, even across large datasets.
  • BM25 Scoring: Leveraging the industry-standard BM25 algorithm (similar to Lucene), Tantivy delivers accurate and relevant search rankings based on keyword relevance.
  • Natural Query Language Support: Construct sophisticated searches using natural language operators like AND, OR, and NOT. For example: (product AND design) OR "user experience".
  • Phrase Search: Find exact phrase matches by enclosing your query in double quotes. For example: "machine learning".

Personalized Search with the rank Endpoint and text_query

To create truly personalized search experiences that go beyond basic keyword matching, combine the power of Shaped's rank endpoint with the text_query argument:

shaped rank \
--model-name your-model-name \
--user-id "your-user-id" \
--text-query "your-text-query"

By incorporating the user ID alongside the text query, you unlock personalized search results that are:

  • Context-Aware: Shaped considers both the user's past behavior and the provided text query to surface the most relevant results.
  • Balanced: Achieve an optimal balance between keyword relevance and user preferences. Users see results related to their search terms but also tailored to their individual tastes.
  • Dynamic: As users interact with your platform, their personalized search results evolve and adapt to reflect their evolving interests.
  • Unified Platform: Handle both recommendations and search within a single, integrated system, simplifying your infrastructure and data pipelines.
  • Personalization at its Core: Leverage Shaped's robust personalization capabilities to deliver tailored search experiences that enhance user satisfaction and engagement.
  • Seamless Integration: Easily integrate search functionality into your applications using Shaped's intuitive API.

Conclusion

Shaped provides a powerful and versatile foundation for building a wide range of search experiences. From simple keyword-based retrieval to sophisticated personalized search, Shaped empowers you to deliver the engaging and relevant discovery experiences your users demand.