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.
AND
andOR
cannot be used together in the same search criteria.- Search criteria can contain upto 5
AND
orOR
operators. *
wildcard can only be used in suffix of search terms liketest*
,image*
.
Examples
- to search and retrieve assets that contain for
john
ordan
in a custom field calledcustomerName
, use"customerName":"john OR dan"
- to search and retrieve assets that contain the term
john
in the custom field calledcustomerName
, use"customerName":"john"
- to search and retrieve assets that contain the term
john
orjohny
orjohnny
in a custom field calledcustomerName
, use"customerName":"john*"
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_by
parameter. - Search conditions are additive. FileSpin applies
AND
when searching for more than one condition, e.g. if you providekeyword
andcontent_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.