Database Search
Version 1.4

Contents

Menu commands

Search dialog

Builtin filter modes

Preferences

FAQ

Links

Menu commands

Showing the search dialog

Choose Libary/Database Search from the main menu to show the search dialog.

Searching for same artist (or other field)

To search the database for songs with the same artist as a given song, select that song (either in playlist, albumlist, or any other place that allows the use of standard foobar2000 context menu commands) and choose Search for Same/Artist from the context menu. This command only shows up, if you have a format preset called "artist" (chararcter case is ignored, so it may be called "Artist" as well) and the Search for Same submenu is inserted into the context menu. In addition, the "artist" preset has to be enabled for the context menu in the Database Search preferences.

The Search for Same/More... command lets you choose an arbitrary format preset to use for the search. Additionally, you can define your own format presets and enable them to be directly available in the Search for same submenu.

Showing the help file

To show the help file, run the Help/Database Search Online Help command from the main menu.

Search dialog

Dialog Elements

The search dialog contains several elements that allow you to control the search parameters and display information.

Source selection box
Located in the first row with the label "Search:". Here you can select where the items that will be tested come from.
Format preset selection box
Located on the left side in the second row next to the "Format:" label. Here you can select one of the format presets configured in the Database Search preferences. Some filter modes do not use a format preset, in this case this control will be disabled. The other filter modes use the titleformatting script associated with the selected format preset to produce a reference string for each item that is tested. How this reference string is used depends on the filter mode.
Filter mode selection box
Located on the right side in the second row. Here you can select the current filter mode. If you want to hide rarely used modes in this combo box, you can open the context menu - by right clicking on it, or by using the keyboard - and deselect the modes you do not want. The context menu will be closed after you select an entry, so if you want to alter the state of more than one item, you have to open the context menu multiple times.
Pattern input field
Located in the third row with the "Pattern:" label. Here you can enter what you are searching form. The interpretation of the pattern depends on the filter mode. Some filter modes do use the pattern, in this case this control will be disabled.
Result view
Located in the lower part. The result view looks and behaves much like the playlist view in the Default User Interface. See the other sections in this chapter for information how it behaves differently. The formatting script used for the result view can be configured in the Database Search preferences.
Status bar
Located at the bottom. The status bar displays additional useful information. Most of the time, it displays information about the item that has the focus in the result view. The format script for this information can be configured in the Database Search preferences. When a context menu is active in the result view, it will display information about the highlighted command, if available. It may also display display information about filter modes and sources, when the respective selection boxes are selected.

Keyboard shortcuts

Keyboard shortcuts that are available in the search, format, pattern, and filter mode fields only:

Keyboard shortcuts that are available in the resultlist only:

Keyboard shortcuts that are available in the whole dialog:

Mouse controls

Mouse interaction for the result view works as in the playlist view of the Default User Interface, except the result list cannot be edited. The notable differences are:

Builtin filter modes

Phrase based modes

Phrase based modes generally take the whole pattern without breaking it up into words, and match it against the reference string which is derived from the item to be tested by using the format script from the format preset. See the description of the individual mode

The Find exact text mode

This filter applies the format given in the format field to any item that is tested. If the content of the pattern field is identical to the resulting string (ignoring character case), the item passes the test. If the pattern field is empty, no item passes the test.

Example:

The Find prefix text mode

This filter applies the format given in the format field to any item that is tested. If the content of the pattern field is a prefix of the resulting string (ignoring character case), the item passes the test. If the pattern field is empty, no item passes the test.

Example:

The Fnid parshe mode

Note: The name of this mode is not misspelled by accident. It is deliberately written as it is. It is an anagram of Find phrase.

This search mode is partly a joke based news about results from researchers at an English University which spread through the Internet quite a while ago. You can easily test for yourself that you an still reads words where the middle letters have been scrambled. This search mode uses a related approach. However, it does not break up the input into words. It simply tries to find the first character followed by an anagram of the middle characters followed by the last character in the reference string. If the input consist of only one or two characters, it tries to find exactly the input instead.

Example:

PS: Are you still taking this filter mode seriously? :)

Word based modes

Despite their name, these filter modes can be used to search much more than just individual words. They break up the pattern into a list of whitespace delimited terms, each of which represents a single condition. The individual modes differ in the number of conditions that an item has to satisfy to be included in the result.

Words and phrases

For the purpose of the word based modes, a word is sequence of characters that does not contain whitespace and starts with any character except plus sign (+), minus sign (-), or double quotation mark ("). A phrase is a sequence of characters delimited by double quotation marks. For example,

king for "a day"

is parsed as the two words "king" and "for" followed by the phrase "a day". On the other hand,

king"dom"

is parsed as a single "word". A word or phrase condition term is satisfied, if the word or phrase is contained in the reference string; character case is ignored, and the word or phrase does not need to match on word boundaries in the reference string.

Testing the presence of fields

To test the presence of field, write the field name enclosed in percent signs, like this:

%album artist%

Note that you can use spaces in the field name. If the field name starts with two underscores, the filter scans for a technical information field, otherwise it scans for a regular metadata field. It does not use titleformatting, so field remappings have no effect here. However, you can use the wildcard characters '?' and '*' in the field name. A question mark matches a single character, while the multiplication sign matches zero or more arbitrary characters. If there is any field that matches the name pattern, the condition is satisfied.

Testing the value of fields

In addition to merely testing the presence of a field, you can also test its value in various ways. To do so, enter the name of the field enclosed in percent signs followed by one of the comparison operator characters described below and finally a word or phrase that specifies the value the field is tested against. The field name can contain wildcards like when testing for the presence of a field. In this case the condition is satisfied, if any of the fields matching the given pattern passes the test. Character case is ignored for both the field name and the given value. Note that there may be space between the fieldname and the comparison operator, or between the comparison operator and the value.

To test if a field value equals a given text, use the '=' (equal sign) operator.

%artist%="dave matthews"

To test if a field value contains a given text, use the '~' (tilde) operator.

%artist%~king

To test if a field value sorts before or after a given text, use the '<' (less-than sign) or '>' (greater-than sign) operator. The sorting order is lexicographically, that is it compares two texts character by character, with the exception of numeric fields which are compared as natural numbers.

%__bitrate%<128

The + and - prefixes

Any of the above condition terms can be prefixed with a + or - character. A condition term that has one of these prefixes must always be satisfied (+) or not satisfied (-), in either case it is not counted when determining the number of conditions that has to be satisfied.

Examples:

The Find all words mode

This filter mode requires that all conditions are satisfied.

The Find any word mode

This filter mode requires that at least one condition is satisfied.

The Find most words mode

This filter mode requires that at least half of the conditions are satisfied. If the number of conditions is odd, it rounds up.

Special modes

The All items mode

You can use this filter mode to view all the items in the source.

The Infoless items mode

This filter tests whether information about an item is available in the database. If no information is available, the item passes the test.

The Query mode

This filter mode interpretes the pattern as a query in playlist generator query syntax and uses that to filter the source items. If the pattern cannot be interpreted as a valid query, no items are returned.

Preferences

The Database Search preferences page is a subpage of the Media Library page. There are multiple tabs on the Database Search preferences page. See below for a description of each.

Title Formatting

On the Title Formatting tab you can modify the formatting scripts that affect how items are displayed in the result view, waht extra information is displayed in the status bar, and how items from unsorted sources are sorted. From the builtin sources, ony the Media Library is affected by the sorting script.

Display

The Display tab contains the settings for the colors and font used in the result view. The text color can be overridden in the display formatting script by using color codes.

Format Presets

This tab is used to manage the format presets. In addition, it contains the settings for the Search for Same function.

Other

This page currently contains two options:

Default action
Use this to select the action that will be executed when you double-click an item in the result view or press the Return key in the result view.
Update search results when query changes
If this option is enabled, the results in the search window are automatically updated when any parameter of changes. If it is off, you have to press the Return key while the source selection box, the format preset selection box, the filter mode selection box, or the pattern input field is selected.

FAQ

Why do I get no results when searching the media library?

Go to Preferences/Media Library and check the settings there. You need to have at least one directory added there.

Why does the help command not work?

The help command opens the online help file, so you need to be connected to the internet. If your browser displays a "File not found" error, check the URL first: if it points to http://www.stud.uni-karlsruhe.de/~uzbs/fb2k/html/foo_dbsearch_help.html you should get a newer version of the component. Otherwise please post about this in the Database Search thread on the foobar2000 forum; your post should include the URL the component tried to open.

How do I make playing the selected result item the default action?

To do this, you need to set the default action to the Play command. This command is provided by foo_utils, so you have to install this component to get this functionality.

more to come...