You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/articles/forget_text_to_sql.md
+25-26Lines changed: 25 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ Search technology has evolved significantly – and so have user expectations, e
5
5
In this article, we’ll show you how to build a modern search system for e-commerce products using natural language queries that leverage context, rather than traditional text-to-SQL approaches that struggle with meaning.
6
6
7
7
## The Shortcomings of Traditional Search
8
+
8
9
Traditional keyword-based search with filters often fails to capture the meaning of complex queries that combine multiple attributes - like text descriptions, numerical data (eg. price), categorical information (eg. product type), and ratings. For example:
9
10
10
11
- "comfortable running shoes for marathon training under $150"
@@ -15,23 +16,24 @@ Traditional keyword-based search with filters often fails to capture the meaning
1.**Process your Product Data**: clean and prepare Amazon product data (title, description, price, ratings, etc.)
36
38
2.**Define your Schema**: define your product data structure using Superlinked's schema system, much like you would using Python data classes or Pydantic.
37
39
@@ -53,10 +55,10 @@ product = ProductSchema()
53
55
```
54
56
55
57
3.**Create your Vector Embeddings**: Superlinked's approach lets us combine various types of data into a single vector index:
56
-
- categories
57
-
- text
58
-
- numbers (floats and integers)
59
-
- temporal data (supported, but not used in our example here)
58
+
- categories
59
+
- text
60
+
- numbers (floats and integers)
61
+
- temporal data (supported, but not used in our example here)
60
62
61
63
```python
62
64
# Create similarity spaces for different attributes
Using a multi-attribute vector search system, the query
126
-
127
+
Using a multi-attribute vector search system, the query
127
128
128
129
```text
129
130
"psychology books with a price lower than 100 and a rating bigger than 4"
@@ -132,17 +133,17 @@ Using a multi-attribute vector search system, the query
132
133
gets automatically decoded into:
133
134
134
135
```text
135
-
semantic search elements:
136
-
description="psychology"
136
+
semantic search elements:
137
+
description="psychology"
137
138
price=100
138
139
rating=4
139
140
filters: type="book"
140
141
```
141
142
142
143
Our system then performs vector similarity search across all attributes simultaneously, providing more nuanced and relevant results than traditional filtering.
143
144
144
-
145
145
## How to Get Started
146
+
146
147
A complete implementation of this system is available on [GitHub](https://rebrand.ly/amazon-tabular-semantic-github). It includes:
147
148
148
149
- Data processing scripts
@@ -151,11 +152,9 @@ A complete implementation of this system is available on [GitHub](https://rebran
151
152
- Streamlit interface
152
153
153
154
## Conclusion
154
-
Combining vector embeddings and natural language processing is by far more intuitive and powerful than traditional text-to-SQL methods in handling the complexities of e-commerce search. Using a multi-attribute vector search platform like Superlinked’s, you can build modern search experiences that meet the expectations of 21st century e-commerce users, without the complexities and deficiencies of manual SQL query generation, or the overhead of maintaining a separate search index for each different attribute type.
155
-
156
-
157
155
156
+
Combining vector embeddings and natural language processing is by far more intuitive and powerful than traditional text-to-SQL methods in handling the complexities of e-commerce search. Using a multi-attribute vector search platform like Superlinked’s, you can build modern search experiences that meet the expectations of 21st century e-commerce users, without the complexities and deficiencies of manual SQL query generation, or the overhead of maintaining a separate search index for each different attribute type.
158
157
159
-
Ready to try it out yourself? Superlinked is here to help you with your implementation. We also offer a fully-managed cloud service. Don’t hesitate to [get in touch](https://superlinked.typeform.com/to/LXMRzHWk?source=vh-paul-article&typeform-source=vh-paul-article)!
158
+
Ready to try it out yourself? Superlinked is here to help you with your implementation. We also offer a fully-managed cloud service. Don’t hesitate to [get in touch](http://getdemo.superlinked.com/?utm_source=vh-paul-article)!
160
159
161
-
*This article is based on [Paul Iusztin](https://www.linkedin.com/in/pauliusztin/)’s tutorial on Decoding ML - check out the full version [here](https://decodingml.substack.com/p/forget-text-to-sql-use-this-natural).*
160
+
_This article is based on [Paul Iusztin](https://www.linkedin.com/in/pauliusztin/)’s tutorial on Decoding ML - check out the full version [here](https://decodingml.substack.com/p/forget-text-to-sql-use-this-natural)._
0 commit comments