One file within a repository branch whose content contains the searched-for text, together with the line numbers it was found on. Produced by {@link RepoSearchManager}. The content hash is carried alongside the path because repository content is content addressed and heavily shared between repositories and versions, so the same bytes routinely match in many places at once and callers usually want to collapse those into a single result.
Group: Managers
Properties
| Property | Returns | Description |
|---|---|---|
| branch | Branch | The branch the matching file was found on. |
| branchName | String | The name of the branch the matching file was found on. |
| contentHash | String | The hash of the file's content. Identical files in different repositories or versions share one hash, so this can be used to collapse results which are really the same bytes found in several places. |
| dir | boolean | True when the match is a directory rather than a file, which can only ever be a name match. |
| lineNumbers | List<Integer> | The one-based line numbers the search text was found on, in ascending order. |
| matchedOn | String | Whether the search text was found in the file's content or only in its name. Either "content", in which case there are line numbers, or "name", in which case there are not. |
| matchingLines | List<String> | The text of each matching line, in the same order as the line numbers, trimmed and truncated so it can be shown as a snippet in search results. |
| name | String | The name of the matching file, without any directories. |
| path | String | The path of the matching file as a string, for callers which just want to render it. |
| pathToFile | Path | The path of the matching file within the branch, always beginning with a slash. |
| repo | Repository | The repository the matching file lives in. |
| repoName | String | The name of the repository the matching file lives in. |
| type | String | The node type, using the same single character codes as the repository tree: d for a directory, f for a file. |
Methods
getRepo() · getBranch() · getPathToFile() · getPath() · getName() · getContentHash() · getLineNumbers() · getMatchingLines() · getRepoName() · getBranchName() · getMatchedOn() · getType() · isDir()
getRepo()
Returns: Repository
The repository the matching file lives in.
getBranch()
Returns: Branch
The branch the matching file was found on.
getPathToFile()
Returns: Path
The path of the matching file within the branch, always beginning with a slash.
getPath()
Returns: String
The path of the matching file as a string, for callers which just want to render it.
getName()
Returns: String
The name of the matching file, without any directories.
getContentHash()
Returns: String
The hash of the file's content. Identical files in different repositories or versions share one hash, so this can be used to collapse results which are really the same bytes found in several places.
getLineNumbers()
Returns: List<Integer>
The one-based line numbers the search text was found on, in ascending order.
getMatchingLines()
Returns: List<String>
The text of each matching line, in the same order as the line numbers, trimmed and truncated so it can be shown as a snippet in search results.
getRepoName()
Returns: String
The name of the repository the matching file lives in.
getBranchName()
Returns: String
The name of the branch the matching file was found on.
getMatchedOn()
Returns: String
Whether the search text was found in the file's content or only in its name. Either "content", in which case there are line numbers, or "name", in which case there are not.
getType()
Returns: String
The node type, using the same single character codes as the repository tree: d for a directory, f for a file.
isDir()
Returns: boolean
True when the match is a directory rather than a file, which can only ever be a name match.