Searching in Code Review
Searching in Code ReviewIn Code Review, you can perform full-text or keyword searches for revisions, actions and comments on your feed page. Any matches to your search criteria are returned with the most recent date at the top of the list. A search will retrieve information only from revisions that have been loaded (either with the--revision option of kwscm, or on demand). You can use keywords, full-text search, or a combination. Full-text searches are applied to file names, revision commit messages, comments and actions. Basic supported search patterns are described with examples below. See Using Keywords to filter search results for information on using simple and complex keywords to search a code review. Items you want to exclude (-)Preceding your search criteria (either keyword or text) with a minus sign indicates that you want to exclude items from your specified criteria, for example: message:"needs research" -file:foo.c returns any comments, actions and commit messages that match "needs research" in files other than foo.c. Klocwork does not support using the minus sign with the text keyword. Phrase search ("")Use double quotes to indicate a phrase or expression that contains spaces or punctuation. For example: message:"needs more research" Wildcard (*)The wildcard is implictly applied to all string searches. For example, a search for the pattern: message:"test5" will return all instances of "test5" even when the instance is surrounded by other characters, including spaces. A search for the following pattern:
message:"test*5" will return all patterns such as "testserver5", or "test server 5". Exact match (+)Use the plus-sign to indicate an exact match is required for your keyword or full-text search. For example: file:+moo.c Returns only files that exactly match "moo.c" On the other hand, if you specify (without the plus-sign): file:moo.c Then any file or path that contained "moo.c" would be returned, such as "smoo.c". Note: You can precede a keyword with a minus sign, but not a plus-sign. Example: -file:foo.c is permitted, but +file:foo.c is not. The OR operatorThe default search behavior is to consider all keywords or text and list those issues that match all criteria. Use OR or "|" to override this behavior. For example: PPR2777 OR PR2778 The above query will return matches to revision commit messages, actions or comments that contain "PR2777" or "PR2778". This can also be expressed as: PR2777 | PR2778 The OR operator can also be used to group search results. For example, if you want to search for everything one particular user is responsible for, do the following: actions:open responsible:+'John Doe' OR commits:any reviews:pending reviewer:+'John Doe' This search will show all the tasks that John Doe is currently responsible for. Opening a revision from an external toolYou can link to a specific revision from an external tool such as JIRA or Bugzilla, by specifying a URL and revision number. For example:
http(s)://<host>:<port>/codereview/CodeReview.html#search_goto:q=<url encoded search>,openCommit=true where <url encoded search> is the URL encoded search query, for example: revision%25253A%25252B%252522107841%252522%252520project%25253A%25252B%252522win_all_sources%252522 Specifying openCommit=true; takes the user directly to the revision specified in the query. If multiple results are returned, the user is presented with a list of all search results. Using Keywords to filter search resultsYou can use keywords and matching key values to narrow your search focus. For example: <keyword>:<string>
comment:"needs more research" file:cruise.java,outsinks.c user:jleeIf you enter: file:foo.c moo.c noo.cthe search engine will look for files that match "foo.c" and then do a full-text search for "moo.c" and "noo.c" in revision commit messages, actions or comments. Searching by simple keywordYou can use the following simple keywords to return information from code reviews and existing revisions.
Note: You can negate search phrases in your query to filter data out of your search results.
For example, to return all comments and actions except those by user JDoe, prefix your search keyword with a hyphen: type:actions,comments -author:JDoe You can negate any keyword. The following example returns all activity for the current week, with the exception of approved commits: changed:'this week' -commits:approved Searching using entities and states (complex keywords)You can use the following keywords with entities and states to return information from code reviews and existing revisions. The keyword entities described in the table below must be matched with an associated state in order to filter results correctly. For example:
commits:pending file:/branches/BR_9_6where commits is an entity and pending is a state.
Searching by user roleYou can filter your search results given one or more user roles, where a user role represents the activity performed by a user. For example, author or submitter.
Filtering by dateYou can filter your searches by date allowing you to return results according to individual dates or ranges of dates. To filter results by a single date, simply specify the date keyword along with a valid <datespec> value:
type:commit reviews:pending created:'January 1, 1970'Note that all date values must be surrounded by either single or double quotes. To return results for a range of dates, specify a hyphen between two valid <datespec> values. type:commit reviews:pending created:'January 1, 1970'-'last month'
The following date formats are valid for the English Locale:
"yyyy", "MM yyyy", "MM, yyyy", "MMM yyyy", "MMM, yyyy", "MM/dd/yy", "MM/dd/yyyy", "yy-MM-dd", "yyyy-MM-dd", "dd MMM yyyy", "dd MMMMM yyyy", "EEE, dd MMM yyyy HH:mm:ss Z", "dd MMM yyyy HH:mm:ss Z", "dd MMM yyyy HH:mm", "dd MMM yyyy hh:mma", "dd MMM yyyy hh:mm a", "EEE, MMM dd, yyy", "MMM dd yyyy", "MMM dd, yyyy", "MMM dd'st', yyyy", "MMM dd'nd', yyyy", "MMM dd'rd', yyyy", "MMM dd'th', yyyy", "yyyy dd MMM", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd hh:mm:ss a", "yyyy-MM-dd hh:mma", "MMM dd, yyyy hh:mm a z", "MMM dd, yyyy HH:mm:ss Z", For the Japanese locale: "y年M月d日(EEE) H:mm:ss", "y年M月d日 H:mm:ss", "yyyy年MM月dd日(EEE)", "yyyy年MM月dd日" Note: If the search engine does not recognize the keyword, then the specified value (after ":") is treated as a text search.
|