Inconsistent search results
AnsweredDescription of the Issue
I am having issues with client.search.query
not returning the expected results. My query looks like this:
const extension = <EXTENSION>; // string
const filename = <FILENAME>; // string
const query = {
content_types: ['name'],
type: 'file',
file_extensions: extension
};
const results = await client.search.query(`"${filename}"`, query);
Sometimes the results come back empty, even though there are files that exist in my Box account that match the given filename. However, sometimes the results come back partially correct, as in some of the files that match the given filename are returned but others are not. Sometimes all of the correct results are returned. I think it might be something to do with the age of the file, as I can never get the correct results for newly created files. I expect the query to work for files that have been recently created and even immediately after they are created.
I have posted this issue on the box-node-sdk Github (https://github.com/box/box-node-sdk/issues/565), and they directed me here as it seems the issue is with the API not the SDK. They informed me that it is expected for the API to take some time to index new files so they are searchable via API. I am expecting to be able to search for files in <1s after they are created. Is this possible?
Steps to Reproduce
- Upload a file from UI or from SDK
- Soon after file creation, query for the filename with the query used above
- Recently created file is not in the search results
Expected Behavior
Recently created file is in the search results
Error Message, Including Stack Trace
No error messages
Versions Used
Node SDK: ^1.34.3
-
Official comment
Hello,
This is expected behavior. It can take 10-15 minutes for new content to be indexed and become searchable, as documented here.
Best,
Kourtney, Box Developer Advocate
Comment actions -
Hi we are having a similar issue but these files are not new files.
I've attached two screen shots. One shows that it doesn't find the file being searched for and the second proves the file by that name exists. This happens all the time. It's terrible and doesn't make sense as thats not how the search function is supposed to work.
this has been going on for a long time now. please fix this.
Post is closed for comments.
Comments
2 comments