Safe Haskell | Safe-Inferred |
---|
A simple tag-oriented query language, and an index for fast-ish searching.
The syntax is documented by Query
.
Synopsis
- type Search = Query -> [InstT.Qualified]
- newtype Query = Query [Clause]
- data Clause = Clause Bool Tag.Key Tag.Value
- search :: Index -> Search
- tags_of :: Index -> InstT.Qualified -> Maybe [Tag.Tag]
- data Index = Index {}
- empty_index :: Index
- merge_indices :: Index -> Index -> Index
- make_index :: Inst.Db code -> Index
- parse :: Text -> Query
- query_matches :: Index -> [(Tag.Key, Tag.Value)] -> [[InstT.Qualified]]
- instrument_tags :: Inst.Db code -> [(InstT.Qualified, [Tag.Tag])]
- synth_tags :: (InstT.SynthName, Inst.Synth code) -> [(InstT.Qualified, [Tag.Tag])]
- common_tags :: InstT.SynthName -> InstT.Name -> Common.Common code -> [Tag.Tag]
- inst_tags :: Inst.Backend -> [Tag.Tag]
- normalize_tags :: [Tag.Tag] -> [Tag.Tag]
- control_tags :: Control.ControlMap -> [Tag.Tag]
Documentation
type Search = Query -> [InstT.Qualified] Source #
A simple tag-oriented query language. Instruments match whose tags match
all of the given TagKeys exactly, and whose corresponding vals have the
queried val as a substring. All the pairs must match, but pairs that match
nothing won't cause the match to fail. A tag beginning with !
will
subtract its matches from the result.
For example, a single word tag1
will match all instruments that have the
given tag. tag1=x
requires that tag1 has an "x" in it.
tag1=x tag2=y !bad !not=want
requires both tags to match, the bad
tag
to not be present, and the not
tag to not contain "want".
Clause inverted? tag val
search :: Index -> Search Source #
Search the db. The input Query is in the parsed db query language, and the output is the names of matching patches, along with their backend.
An empty query matches everything.
empty_index :: Index Source #
merge_indices :: Index -> Index -> Index Source #
Merge the indices, favoring instruments from the left one.
make_index :: Inst.Db code -> Index Source #
parse :: Text -> Query Source #
The query language looks like "a b= c=d !e=f", which means
Query [Clause False "a" "", Clause False "b" "", Clause False "c" "d", Clause True "e" "f"]
TODO parse quotes for keys or vals with spaces
implementation
query_matches :: Index -> [(Tag.Key, Tag.Value)] -> [[InstT.Qualified]] Source #
instrument_tags :: Inst.Db code -> [(InstT.Qualified, [Tag.Tag])] Source #
synth_tags :: (InstT.SynthName, Inst.Synth code) -> [(InstT.Qualified, [Tag.Tag])] Source #
common_tags :: InstT.SynthName -> InstT.Name -> Common.Common code -> [Tag.Tag] Source #
inst_tags :: Inst.Backend -> [Tag.Tag] Source #
Get tags of an inst, including automatically generated tags.
normalize_tags :: [Tag.Tag] -> [Tag.Tag] Source #
control_tags :: Control.ControlMap -> [Tag.Tag] Source #