Is Search Code API reliable? #48703
-
Select Topic AreaQuestion BodyI'm talking about the standard search engine --not the new beta one-- Long story short: I'm working on a tool to keep track of python requirements for my team. This tool use the API to fetch all repositories that include a given requirement. Testing the tool I've seen that each run gave me different results and I figured out that the issue came from the API response. Calling the following request many times over time give me different results: The same issue happens using the pagination mechanims (next Link on headers) So I made an experiment with a (hugly) workaround that check for a stable total_count (426 in my case) and retry each request (page) if the total_count value does not match. That way I obtained less discrepancy between results: 2 or 3 over 229 repos against up to 50 without the workaround. Missing repos are not the same each run, look like a non-deterministic behavior. So my questions are:
Thanks in advance for Your feedback and sorry for the long post. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
@FabioBis sorry about that. The code search API should be treated as best effort right now. We are working on a new API which should be more reliable. As a workaround, consider using the content API to fetch the file content from the repositories you're interested in. |
Beta Was this translation helpful? Give feedback.
-
If there is a new search feature coming, that will be great, because I never find anything with the current search feature (top left search field). Entering a search query either A) does not return anything when it should, or B) return something that does not match the search terms. In short, the current search feature is quite useless and broken. Kinda reminds me of Bing.... oh... |
Beta Was this translation helpful? Give feedback.
-
Adding on our very similar problem with likely the same root cause. I'm trying a further reduced search from OP looking for a specific file (of which there are 1 or 2) within a specific repository. Example:
And this is returning 0 results, consistently now, where it would return 2 results just 1 month ago in April 2023. I understand from this thread that the current Search API is Best Effort, but it is still surprising given a specific repository constraint, that it can't find all file metadata. i.e. no content search, just tell me the existence of a file name in a repo. |
Beta Was this translation helpful? Give feedback.
@FabioBis sorry about that. The code search API should be treated as best effort right now. We are working on a new API which should be more reliable.
As a workaround, consider using the content API to fetch the file content from the repositories you're interested in.