Understanding VisualSVN Server search syntax

Applies to: VisualSVN Server 5.0 and later

VisualSVN Server provides a full-text search for your repositories. The search engine has a wide set of capabilities, including support for complex expressions and querying metadata. This article describes the search syntax in detail.

Note
Please consider the article KB178: Getting started with full-text search if your VisualSVN Server installation does not have the search feature enabled yet.

Search syntax basics

The search interface and syntax is intuitive and is similar to that of typical search engines. When you type the word hello into the search box and press Enter, the search will find all files and folders whose names or contents contain it.

However, you need to take the following aspects into account when searching in your repositories.

Search is case insensitive

All search queries in VisualSVN Server are case insensitive. Searching for hello, Hello or HELLO will always return the same results. An exact match search query described below is also case insensitive.

Exact match search uses quotes

All types of queries support searching for exact matches. To search for an exact phrase, you need to put the terms in double quotes, as in the following example:

"hello world"

The result of this query will include the exact phrase hello world, but not hello wonderful world or helloworld. Note that the results can also include variations of the "hello world" phrase with a delimiter, such as hello-world and hello, world.

Note
As said above, the exact match search is case insensitive as well as any other search query.

Smart handling of CamelCase, under_score and numbers

The search supports specialized handling of CamelCase, under_score and numbers, which is especially useful when searching through the source code.

For example, the search results for hello will include all matching compound words:

  • With CamelCase: helloWorld, helloWonderfulWorld, HelloWorld, HelloWonderfulWorld
  • With under_score: hello_world, hello_wonderful_world
  • With numbers: hello123, hello123World, hello_world123
Tip
Use quotes if you need to disable any kind of compound word matching. If you search for "hello" (in quotes), the result will not include compound words such as helloWorld.

Advanced search keywords

The search supports several keywords for narrowing down your search results. For example, you can search only in the contents of certain file types. Or you can search only by the username of the commit authors when searching through history.

The following table shows the keywords available for Content and History search types. Note that keywords have aliases, which are given on separate lines.

Search type Keyword and its alias Examples Description

Content

content:
contents:

content:(hello world)

Search for files with the specified content.

filename:
name:

filename:*.txt

Search for files and directories with the specified name.

History

log:
message:

log:(revert commit)

Search through commit log messages.

author:
user:

author:john

Search through usernames of commit authors.

A detailed description of the keywords with examples is given below.

Searching with a combination of keywords

You can combine compatible keywords into a single query:

  • The content: and filename: keywords can be combined when searching through content.

    For example, you can search in content of all .c files for the "int main" exact match (in quotes):

    filename:*.c content:"int main"

  • The log: and author: keywords can be combined when searching through history.

    For example, you can search through history for all commits whose author's username is myuser and the log message includes the words hello and world:

    author:"myuser" log:(hello world)

See below for a detailed description of the keywords and more examples.

Searching in file contents with content:

You can use the keyword content: to limit the search to only files with the specified content, without searching by filename. For example, the results of the search query content:form will include all files that contain the word form, but will not necessarily include files that have form in their name (such as LoginForm.cs)

Note
The content: keyword is only available when searching repository contents and is not available when searching history.

The content: keyword can be used to search for exact matches and multiple words:

  • Search for files whose contents include the specified word:

    content:hello

  • Search for multiple words in file contents:

    content:(hello world)

    When searching using a keyword for a phrase, but without exact match search, you need to put the phrase in parentheses.

  • Search for the exact phrase in file contents:

    content:"hello world"

    When searching for an exact phrase, you need to put the phrase in quotes.

The alias keyword contents: is completely interchangeable with the described content: keyword.

Searching in file names with filename:

You can use the keyword filename: to limit the search to only files and folders with the specified name. For example, the results of the search query filename:main will only include files and folders that have the word main in their name (such as main.cpp).

Note
The filename: keyword is only available when searching repository contents and is not available when searching history.

The keyword filename: supports quotation marks to search for exact matches, and it also supports the * and ? wildcard characters:

  • Search for files and directories whose name is build exactly:

    filename:"build"

    For example, this query can find a directory build, but not a file build.conf.

  • Search for files and directories whose name ends with .txt. You can use this search query to find files with the .txt extension:

    filename:*.txt

  • Search for files and directories whose name matches the specified pattern:

    filename:prop???-cmd.c

    For example, this query can find a file with name propdel-cmd.c and a file with name propget-cmd.c.

The alias keyword name: is completely interchangeable with the described filename: keyword.

Searching in log messages with log:

You can use the keyword log: to limit the search to only log messages with the specified text.

Note
The log: keyword is only available when searching history and is not available when searching repository contents.

The log: keyword can be used to search for exact matches and multiple words:

  • Search for revisions whose log messages include the specified word:

    log:hello

  • Search for multiple words in log messages:

    log:(hello world)

    When searching using a keyword for a phrase, but without exact match search, you need to put the phrase in parentheses.

  • Search for the exact phrase in log messages:

    log:"hello world"

    When searching for an exact phrase, you need to put the phrase in quotes.

The alias keyword message: is completely interchangeable with the described log: keyword.

Searching in commit authors with author:

You can use the keyword author: to limit the search to only commits with the specified username.

Note
The author: keyword is only available when searching history and is not available when searching repository contents.

The author: keyword can be used to search for exact matches and multiple words:

  • Search for all commits whose author's username includes myuser:

    author:myuser

  • Search for all commits whose author's username includes words my and user:

    author:(my user)

    When searching using a keyword for a phrase, but without exact match search, you need to put the phrase in parentheses.

  • Search for all revisions whose author's username is myuser exactly:

    author:"myuser"

The alias keyword user: is completely interchangeable with the described author: keyword.

See also

KB178: Getting started with full-text search

Last Modified: