hello <@U01PL2YSG8L> I'm using semantic search in...
# community-help
h
hello @Kishore Nallan I'm using semantic search in my project but it will provide a found count according to the per_page value. ex: if per_page = 250 so the response of query found value is 250 but I want only that data that match properly because I'm using type sense in eCommerce website so I have to display found count and we are creating pagination using that counts
k
That's because semantic search is basically checking how similar your record is with all other records via approximate nearest neighbour search.
It's not a good idea to paginate for knn search because it's approximate and when you go to page 2, it will request more results and this can result is some duplication of products because the search is approximate.
h
do you have any other approach for use semantic search in e-commerce website ?
k
Request for a large enough k and do in-app pagination. The concept of found does not make sense for semantic search..
h
Ok
can I use hybrid search for this, because it gives me found counts ?
k
Because it uses keyword search also. Semantic component still limit to k records
h
yes
Does it also change facet list as per the pagination?
k
When you have a bounded number of results because of knn search, as we get more results, facets can also change
h
so we can't use semantic or hybrid search in e-commerce website right ?
k
Why not?
As I said earlier, you have to either not display counts or fetch larger number of results, like 100 results and do in-app pagination.
h
Do you have any demos for semantic search + e-commerce websites?
my problem is not only found count but it will change facet values also
Please do some needful
k
You have to pre-fetch the number of results and do in-app pagination.
h
for facet ?
k
You make only one search query with
per_page=100
and then if you are showing 10 docs at a time, use the app to do the pagination so you don't have to query again.
h
Please send one demo example if you have because what you told me is not possible because if i get 100 per page data it will take more time, and after applying facet filters its give mismatched product in results.
I'll DM you one video
j
You want to do something like this to paginate with semantic or hybrid search:
Copy code
{
  "query_by": "text_field, embedding",
  "vector_query": "embedding([], k: 200)",
  "page": 1,
  "per_page": 10
} ⁠
Then change
page
to 2, 3, 4, 5, etc to paginate. The key thing is that you've now grounded the vector search to look at 200 closest items using the
k
parameter
You might also want to use the distance_threshold parameter to fine tune the semantic search like this:
Copy code
{
  "query_by": "text_field, embedding",
  "vector_query": "embedding([], k: 200, distance_threshold: 1.0)",
  "page": 1,
  "per_page": 10
}
CC: @Fanis Tharropoulos Could you add a section to the hybrid search or semantic search docs, documenting the above? It has come up a few times now.
f