HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: Fiend Angelical on 2006-06-08 00:20:35

Title: Query syntax
Post by: Fiend Angelical on 2006-06-08 00:20:35
Hello. As I understand and have been grappling with, foo_autoplaylist and foo_dbsearch (amongst other components) use a logical syntax to define searches. Is there a guide anywhere that helps me learn this syntax properly (so I can stop asking stupid questions)?

Currently, I have this query..

Code: [Select]
((genre IS classical) OR (genre IS soundtrack)) NOT (artist IS bbmak)

What I want is for all classical and soundtrack genres to be found, excluding an artist called bbmak. The above does make sense to me, but the syntax is incorrect according to the program.

Any help is appreciated. Thanks.
Title: Query syntax
Post by: foosion on 2006-06-08 00:43:17
In 0.8.3, the playlist generator came with a help dialog for the query syntax, and I think I posted a description somewhere on the forum, but I don't know where. So I'll just post the help from 0.8.3 for now:
Quote
Query format:

Simple search:
* "<any string>" - returns only items that have all words from specified string in their metadata / tech infos / file path.

Advanced search:
* "<field> HAS <string>" - returns only items that have all words from <string> in metadata field named <field>, e.g. "title HAS blah".
* "<field> IS <string>" - returns only items where (at least one) metadata field <field> is equal to <string>, e.g. "artist IS blah".
* "* HAS <string>" - same as simple search, but can be combined using logical operators (see below).
* "<pattern1> AND <pattern2>" - performs logical AND operation on two search patterns, e.g. "artist IS blah AND title HAS blah". You can also enclose patterns in parentheses to control order of logical operations, e.g. "(artist IS blah) AND (title HAS blah)".
* "<pattern1> OR <pattern2>" - same as above, but with OR logical operation.
* "NOT <pattern>" - inverts results of <pattern>, e.g. "NOT comment HAS sucks".
* "<field> GREATER <number>", "<field> LESS <number>", "<field> EQUAL <number>" - performs integral number comparison between <field> value and <number>, e.g. "date LESS 1998".

Note 1 : <field> and <string> in HAS/IS operations should be enclosed in double quotation marks (") if it includes spaces.
Note 2 : If <field> in HAS/IS/GREATER/LESS/EQUAL includes at least one of #$% characters, it will be treated as title formatting string, e.g. " "%__codec%" IS MP3". Using title formatting string instead of simple field name will decrease search speed and break multiple field handling in IS operator.
Note 3 : All search operations are non-case sensitive. All operator words *must* be uppercase.

Addendum for 0.9:
* "<field> MISSING" - returns only items where <field> is not defined, <field> must be a field name without percent signs