Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Why does the search API sometimes return line as "..."? #4701

Open
samwarring opened this issue Jan 4, 2025 · 0 comments
Open

Why does the search API sometimes return line as "..."? #4701

samwarring opened this issue Jan 4, 2025 · 0 comments

Comments

@samwarring
Copy link

Hello, I have found that for some invocations of the /search API, the search would complete succesfully and return matches to the client, but the matches have line set to "...", and lineNumber set to "" (empty string). I found this usually happens when the search string contains "special characters".

For example, I want to search for std::string in my codebase. I need to escape each : character, and I need to enclose the entire search string in quotes, or else the results include the union of std and string. This gives me a search string of "std\:\:string".

  • A full search for that string gives correct results.
  • A symbol search for that string on the web GUI gives correct results.
  • A symbol search for that string using the REST API gives results where line is "..." and lineNumber is "".

Request is: <server address>/api/v1/search?projects=mainline&symbol=%22std%5C%3A%5C%3Astring%22
Response contains many matching files, but each file has one item {line: "...", lineNumber: "", tag: null}.

Unfortunately, I do not have admin access to the OpenGrok instance I'm using, so I cannot provide server logs, but I do know we're using OpenGrok 1.12.14.

Can someone shed light why I am getting these results? Am I invoking the API incorrectly, or is this a bug? Thank you!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant