The simplest way to search in BLAM is to enter a single term into the search bar. This will search all metadata across all assets in the organisation.
Below the search box is a dropdown, with configurable names.
Fuzzy: Similar to web search engines. Words can be in any order (or enclosed in quotes for an exact phrase) found anywhere in a single metadata field. All words or phrases specified must be found in a single metadata field.
Exact: The field must contain the exact value.
Starts-With: The field must start with the value.
Contains: The field can contain the value anywhere, such as a part of a word or filename. This tends to be slower, so it is only to be used where necessary.
You can search for a particular field by specifying the field name in the query. For example title=Big Buck Bunny. Clauses can be combined with AND and OR, and negated with NOT, e.g. title=Big Buck Bunny AND NOT series_number=1
For advanced searching, toggle “Advanced” and add new clauses with the + icon. The query in the search box at the top is ANDed to the clauses in the advanced search. Advanced search is best used to apply filters to the search, such as media type or workflow status.
Advanced search configurations can be saved as templates, by first adding clauses as desired and then clicking the “Save” icon. Templates can be shared with other users in the organisation, and can contain values or just an “outline” (i.e. without values). “System” templates can be configured by administrators; these are special templates that cannot be modified or deleted, and show up for all users. These typically provide sets of fundamental search filters, such as “Title Only”, “Media Only”, and “Temporal Data”.
For non-fuzzy search clauses, wildcards can be added to the query as asterisks (*), either at the start, at the end, or anywhere else. For example, Relative Path=*.mxf will find all assets with a .mxf extension. For fuzzy search clauses, wildcards only work at the end of the clause value. So title=rab* will find an asset titled “rabbit”, but title=*bit won’t, unless non-fuzzy search is selected. This is useful if you want to search for the first part of a word, but isn’t necessary if the value is separated by spaces. e.g. fuzzy searching for title=Big Buck will find an asset titled “Big Buck Bunny”.
BLAM’s API can be used to search for assets, by making a GET HTTP request to api/assets.
For the query parameter “query”, the query can be supplied as above. However, the frontend provides some abstractions to the query syntax.
To search across all metadata, simply query for a single term, e.g. GET api/assets?query=rabbit. There is no “precision” setting – it can be done with wildcards and operators. For wildcards, these must be explicit. For Starts-With, put a wildcard (*) at the end. For Contains, put a wildcard at the start and the end, and so on.
Fuzzy searching can be done by prefixing ~ to the search term, e.g. ~rabbit. To search specific metadata fields, for non-fuzzy use equals (=), e.g. title=rabbit, and for fuzzy use tilde (~) e.g. title~rabbit
Fuzzy Searching in PostgreSQL and SQL Server Databases
Fuzzy searching in SQL Server uses full text indexes with CONTAINS, while PostgreSQL uses tsvectors and tsqueries. By default, we use FORMSOF(INFLECTIONAL, …) for SQL Server which uses stemming to match words like “run” with “ran”, “running”, etc. For PostgreSQL this can be configured by adding dictionaries such as ISpell to the deployment. By default it uses english_stem, which does not provide the same versatility as in SQL Server, but will match words like “run” with “running” (but not “ran”), etc.
For SQL Server CONTAINS we implicitly AND the terms together, and preserve phrases surrounded in quotes (“). For PostgreSQL we pass the query into websearch_to_tsquery, so that behaviour between the PostgreSQL and SQL Server is as consistent as possible.