#community-help

Query Suggestions for Search Feature on B2B eCommerce Site

TLDR arif needed guidance on implementing query suggestions for a B2B eCommerce website. Jason suggested using Typesense's native search query tracking. After some setup and discussion about delays, it was confirmed the system was working correctly.

Powered by Struct AI
14
4mo
Solved
Join the chat
Jul 17, 2023 (4 months ago)
arif
Photo of md5-e08256d678064813deb604fdf86f0867
arif
09:04 AM
Hi, so far this channel has been very helpful. Thanks a lot.

I need another suggestion regarding Query Suggestions. My site has a large number of pages and a global Search field/widget on top of each page. The requirement is to show popular/relevant search terms/query and actual results of different types in a drop-down list. Showing search result-as-you-type is not applicable for our use-case. What'd be the most effective approach to have meaningful query suggestions along with the categorized results?

One solution comes to mind is to have a secondary index for queries submitted by the users. But this approach unreliable as someone can insert irrelevant/garbage queries in the index. So it does not seems suitable.
Please suggest some standard Typesense solution.

Please note that the search feature is very important as the website is a B2B enterprise eCommerce. So garbage/irrelevant suggestions won't be acceptable.

Thanks!
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
07:44 PM
We’ve added the ability for Typesense to track search queries natively if you want to give it a shot: https://gist.github.com/jasonbosco/0c49916fc2e7a54f30d961aac111cf4a
Jul 18, 2023 (4 months ago)
arif
Photo of md5-e08256d678064813deb604fdf86f0867
arif
06:18 AM
Thanks!
06:24
arif
06:24 AM
Our Typesense cluster version is of v0.25.0.rc32. If we upgrade to 0.25.0.rc52, we'd get the extra collection Out-of-the-box. And we'd be able to query on this collection onward, right? Or should we also prepare the analytics rule first?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:47 PM
After the upgrade, you would have to first create the analytics collection, then setup the analytics rule, and then search terms will show up in the analytics collection you created
Jul 26, 2023 (4 months ago)
arif
Photo of md5-e08256d678064813deb604fdf86f0867
arif
09:55 AM
The analytics collection is missing some search teams. Is this somehow expected? Or Should I check something?
And I don't think I have ever seen any documentation for the Analytics Rules. If there is any, could you please share the link?
09:59
arif
09:59 AM
Note - the following changes have been made.
1. We have upgraded the cluster to v0.25.0.rc53.
2. A new collection has been created with name top_queries
3. A rule has been created as well.
{
  "rules": [
    {
      "name": "top_queries",
      "params": {
        "destination": {
          "collection": "top_queries"
        },
        "limit": 1000,
        "source": {
          "collections": [
            "name_of_the_collection_containing_actual_data"
          ]
        }
      },
      "type": "popular_queries"
    }
  ]
}

Did I miss anything?
10:04
arif
10:04 AM
And is there any delay expected for the queries to show up in the analytics collection?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:30 PM
This is the only docs at the moment: https://typesense-community.slack.com/archives/C01P749MET0/p1689623051117489?thread_ts=1689584645.886149&cid=C01P749MET0

Could you DM me your cluster ID? I can check if everything was setup properly on our side
Jul 27, 2023 (4 months ago)
arif
Photo of md5-e08256d678064813deb604fdf86f0867
arif
08:43 AM
Sent it to your inbox. Please let me know if you need anything else.
Thanks!
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:57 PM
Looks like everything is setup correctly and I do see search terms being logged in your top queries collection…
06:57
Jason
06:57 PM
There is a delay of 5 minutes between the time a query is typed and when it shows up in the top queries collection though… Could it be that?
Jul 28, 2023 (4 months ago)
arif
Photo of md5-e08256d678064813deb604fdf86f0867
arif
07:04 AM
According to my observations, some queries never show up in the top queries collection.
Would you provide any details about the delay? I think sometimes queries show up almost instantly. Is it some kind of max delay?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
07:50 PM
Yeah, it’s a max delay. There’s a 5 minute timer that’s running and it aggregates all search terms in the last 5 minutes

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3011 threads (79% resolved)

Join Our Community

Similar Threads

Troubleshooting Typesense API Analytics Query Suggestions

Md was confused about implementing Typesense's Analytics Query Suggestions and experienced issues with collections returning no hits. Assistance from Kishore Nallan eventually led to the identification that analytics had to be enabled. They also discussed tracking duplicate and empty queries, resulting in Md creating a Github issue.

3

27
3mo
Solved

Resolving Typesense Analytics "top_queries" Collection Issue

Zain faced issues with typesense analytics and an empty "top_queries" collection. Jason and Kishore Nallan assisted in troubleshooting, identified a bug, and suggested a fix in `0.25.0.rc66`. The fix worked for Zain.

3

29
3mo
Solved

Typesense Query Suggestions Throttling Mechanism Discussion

Arad asked about potential abuse of Typesense's query suggestions feature. Jason explained how query uniqueness gets determined based on the `X-TYPESENSE-USER-ID` and `analytics-flush-interval`. It was mentioned creating two GitHub issues about implementing a request limit and ignoring certain search analytics.

3

11
1mo
Solved

Phrase Search Relevancy and Weights Fix

Jan reported an issue with phrase search relevancy using Typesense Instantsearch Adapter. The problem occurred when searching phrases with double quotes. The team identified the issue to be related to weights and implemented a fix, improving the search results.

6

111
8mo
Solved

Revisiting Typesense for Efficient DB Indexing and Querying

kopach experienced slow indexing and crashes with Typesense. The community suggested to use batch import and check the server's resources. Improvements were made but additional support was needed for special characters and multi-search queries.

1

46
9mo
Solved