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 with all assets whose schema ID is 1 and which contain "john" in the "name" field.
{
"schema_criteria": {
"data_schema_id": 1,
"fields": {
"name": "john"
}
}
}| Key | Value | Description |
|---|---|---|
data_schema_id | JSON | Asset Data Schema ID to search on. Mandatory if schema_criteria is given |
fields | JSON | (optional) Field name and the search value |
Custom Schema search with AND, OR and wildcards
Custom Schema search supports AND, OR and wildcards with certain limitations.
ANDandORcannot be used together in the same search criteria.- Search criteria can contain upto 5
ANDorORoperators. *wildcard can only be used in suffix of search terms liketest*,image*.
Examples
- to search and retrieve assets that contain for
johnordanin a custom field calledcustomerName, use"customerName":"john OR dan" - to search and retrieve assets that contain the term
johnin the custom field calledcustomerName, use"customerName":"john" - to search and retrieve assets that contain the term
johnorjohnyorjohnnyin a custom field calledcustomerName, 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, below range query below can use 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 askeyword,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 thesort_byparameter. - Search conditions are additive. FileSpin applies
ANDwhen searching for more than one condition, e.g. if you providekeywordandcontent_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.