#community-help

Understanding 'outOf' in Grouped Query and Documentation Issue

TLDR Bjarte shared a query with strange 'outOf' numbers, and discovered a documentation typo. Kishore Nallan explained the meaning of 'outOf', and they discussed filing an issue and considering convenience methods.

Powered by Struct AI

1

28
7mo
Solved
Join the chat
Mar 13, 2023 (7 months ago)
Bjarte
Photo of md5-a482357c45c14b15b488cadd7bae83d1
Bjarte
08:20 AM
i am running a grouped query in the latest go sdk and are seeing some strange numbers for out_of.
Fetched challenge candidates info found=1809 page=1 outOf=180291

i am fetching page1 there are 1809 total hits and 180k pages? this is my query
    params := &api.SearchCollectionParams{
        Q:             "*",
        QueryBy:       "owner",
        FilterBy:      StringPointer(fmt.Sprintf("number.play_id:%s", ids)),
        IncludeFields: StringPointer("number.play_id,update_at,owner"),
        GroupBy:       StringPointer("owner"),
        PerPage:       IntegerPointer(250),
    }
08:31
Bjarte
08:31 AM
Maybe I can optimize my query as well, what i am looking for here is to fetch all owerns that owns all of the plays i send in. so if i send in 1,2,3 the owner has to atleast own 1 of each play_id to be a hit.

right now I am just doing the rest of the logic in golang, but doing it in lower layers is always better mechanical sympathy wise
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:40 AM
Have you tried making a raw curl request to see if that matches?
08:40
Kishore Nallan
08:40 AM
Out of here means total number of results
Bjarte
Photo of md5-a482357c45c14b15b488cadd7bae83d1
Bjarte
08:41 AM
i have not tried raw curl no
08:42
Bjarte
08:42 AM
but paged works with groups but outOf not?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:42 AM
i.e. out_of is total number of documents in the collection, and this is ungrouped count.
Bjarte
Photo of md5-a482357c45c14b15b488cadd7bae83d1
Bjarte
08:43 AM
ok it says “the total number of pages” in the comment
08:43
Bjarte
08:43 AM
so it looks like it is a documentation bug then
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:43 AM
My bad, that's a typo error
08:43
Kishore Nallan
08:43 AM
Must be a copy paste error
Bjarte
Photo of md5-a482357c45c14b15b488cadd7bae83d1
Bjarte
08:43 AM
do you want me to file an issue?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:43 AM
Yes, thanks
Bjarte
Photo of md5-a482357c45c14b15b488cadd7bae83d1
Bjarte
08:45 AM
the code is generated from openApi it looks like. what repo do you want the issue in? i do not think typesense-go is relevant?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
09:01
Bjarte
09:01 AM
why not just contribute and save you the work
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:07 AM
Thank you! I will update and publish the go client with this change shortly.
Bjarte
Photo of md5-a482357c45c14b15b488cadd7bae83d1
Bjarte
09:07 AM
amazing!
09:08
Bjarte
09:08 AM
btw have you considered adding a method to the typesnse-go client that just fetches all pages if things are paged?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:08 AM
Can you elaborate what you mean by "all pages"?
Bjarte
Photo of md5-a482357c45c14b15b488cadd7bae83d1
Bjarte
09:09 AM
if the searchResult has more then one page then fetch the rest in a convenience method
09:10
Bjarte
09:10 AM
i have it now myself, so not a big one for me, just wondered
09:10
Bjarte
09:10 AM
maybe it is best just to leave that code in userland
09:11
Bjarte
09:11 AM
i can see lots of different strategies for parallelization and error handling
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:11 AM
The client is currently a very thin wrapper around the API but open to adding such convenience methods.
Bjarte
Photo of md5-a482357c45c14b15b488cadd7bae83d1
Bjarte
09:11 AM
ok
09:11
Bjarte
09:11 AM
will consider it if the use case emerges

1