Why does the search API sometimes return line as "..."? #4749
-
| Hello, I have found that for some invocations of the  For example, I want to search for  
 Request is:  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! | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
| Not really an answer, more likely just a hint for those who would like to debug this: the immediate reason for the elipsis ("...") and lack of line numbers is the missing context: Why that appears when searching via the API and not in the UI probably stems from the fact that the search and interpretation of the results is done differently in the UI and API. The API search handling in  Documents and usesContext#getContext()to get the context to assemble the list ofHitobjects which get passed directly into the API result.The UI uses the  Summarizerclass to interpret the results. | 
Beta Was this translation helpful? Give feedback.
I can replicate this with the OpenSolaris workspace. This happens for all of the
std::stringsymbol matches.TLDR: due to the differences in search result interpretation between API search and UI search, the API search can match only definitions, not symbols.
The call to
getContext()inSearchEngine#results():opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/SearchEngine.java
Lines 473 to 477 in 7b5f14f