We are facing an issue with the search API of Box. For example, if I have files named ‘image-1’, ‘image-2’, and ‘image-3’ in Box, and my search term is ‘image,’ I noticed that the ordering of results is not consistent. The order of results varies each time I invoke the API. This inconsistency affects the API results, especially when we use pagination. For instance, if I query to get the first 20 results and then use the ‘offset’ value to retrieve the next page of results, I observe that there are repeated results from the previous API call.
Please consider this issue and provide us with a resolution.
Hi @user129 , welcome to the forum!
That is odd, can you add some more details, like your search query and what you expected vs what you get?
I’ll try to replicate this.
By default it is going to sort by relevance, but duplicate files in pages is something not expected. It is possible thought to have duplicate files in multiple folders, and depending on the “relevance” they could, in theory, show up in different places.
This is due to the search being executed in multiple attributes, name, description, tags, content, etc, each of them have a different impact in relevance.
I’ll happily try to replicate this.
Let us know
For example, I have image files named ‘image-1’ , ‘image-2’ through ‘image-25. All my files are in home and there is no duplicate files’ My search query was as follows:
In the 20th result screenshot, you can observe that the last image is named ‘image-18.jpg,’ with the ID ‘1284091604519.’
Now, when I make a subsequent API request for the next 20 results using the following API:
I receive the same file, ‘image-18.jpg,’ with the same ID, ‘1284091604519.’ and also the order of results varies each time I invoke the API
The response of the second API request
Use this links to access API response:
- First 20 results-link
- 21- 25 results-link
While we look into this further - I see you are using Postman. Just to confirm, did you set up Postman using the quickstart in our developer docs - and use our collection? Or are you just entering the pieces manually?
Thank you for your reply. Previously, I used your collection. However, for better visibility, I manually entered the data and made a request. If I use the collection variable, it won’t be visible in the screenshot, so I entered the data manually.
I chatted with our internal engineering team - it seems that search cannot sort information alphabetically. However, it does seem like the same information appearing on multiple pages could be a bug. In order to get you more help, I’m going to need to create you a support ticket. The support team will be able to take it from there!
Hi SmartOne, I’m not sure which type of search framework you are using. We encountered a similar issue in our product. For relevance field searches, you might need to add an extra field to maintain the consistency of results. This additional field could be ‘modified_at’ or 'created_at.