Skip to main content

Advanced Search Options

Advanced search techniques including exact match, special characters, custom schema fields, range queries, and tips for the Asset Search API.

Search for Exact Match

To search for exact match for a word, enclose the word in double quotes " and escape the double quotes as shown in the examples.

For example:

  • To search for ABC 123, you need to search for "ABC 123" (the double quote escaped format is "\"ABC 123\"")

Search for Words with Special Characters

+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ / are special characters in the search query. To search for a word that contains special characters you should enclose the word in double quotes.

For example:

  • To search for a+b, enclose the word in double quotes like "a+b"
  • To search for ABC-123, provide the search word as "ABC-123"

Search using Custom Schema Fields

FileSpin supports searching on custom schema fields defined as searchable in Custom Asset Schema. You can provide search criteria for custom schema via a JSON as below:

This search with below schema_criteria will return all assets whose schema ID is 1 and which contain "john" in the "name" field.

{
"schema_criteria": {
"data_schema_id": 1,
"fields": {
"name": "john"
}
}
}
KeyValueDescription
data_schema_idintegerAsset Data Schema ID to search on. Mandatory if schema_criteria is given
fieldsobject(optional) Field name and search value pairs

Custom Schema Search with AND, OR and Wildcards

Custom Schema search supports AND, OR and wildcards with certain limitations.

  • AND and OR cannot be used together in the same search criteria.
  • Search criteria can contain up to 5 AND or OR operators.
  • * wildcard can only be used in suffix of search terms like test*, image*.

Examples

  • To search and retrieve assets that contain john or dan in a custom field called customerName, use "customerName":"john OR dan"
  • To search and retrieve assets that contain the term john in the custom field called customerName, use "customerName":"john"
  • To search and retrieve assets that contain the term john or johny or johnny in a custom field called customerName, use "customerName":"john*"

Range Queries for Numerical Fields

For custom schema fields with numerical values, assets can be filtered by range queries.

For example, to retrieve only those assets with value from 0 to 5 for a numerical field called example_field, the range query below can be used:

{
"schema_criteria": {
"data_schema_id": 42,
"fields": {
"example_field": [0, 5]
}
}
}

Where [0, 5] is a range query for assets with the list value for lower and upper range.

In the above range query, assets where example_field >= 0 and example_field <= 5 will be retrieved.

Notes & Tips on Search API

  • To search for exact string match, quote the search string, e.g. "\"my exact search string\"". This will search for the exact string "my exact search string".
  • Custom Schema Fields search using "schema_criteria" can be used in combination with other standard search parameters such as keyword, content_type, sort_by, etc.
  • Rules for searching words with special characters and exact match apply to custom schema fields as well.
  • Search results are sorted by relevance by default. You can sort the results by other supported sort fields such as upload_time, file_size, etc. using the sort_by parameter.
  • Search conditions are additive. FileSpin applies AND when searching for more than one condition, e.g. if you provide keyword and content_type, the search will return files that match both the keyword and content type.
  • Do not pass empty string value for a field in search query. Instead, remove this field from the search condition.