Search in IT Hit Ajax File Browser
IT Hit Ajax File Browser supports WebDAV DASL search. It provides search field with a popup hint and dynamic search results.
Discovering DALS Search support
To enable or disable the search field the IT Hit Ajax File Browser relies on SEARCH token in Allow header. It submits OPTIONS request to your WebDAV server root (not to web site root) specified in Url property in settings object.
Pop-up hint and dynamic search results
The IT Hit Ajax File Browser can display a pop-up hint in the search field when user is typing a search phrase as well as it can show results dynamically when typing. Both features are enabled by default and Ajax File Browser is constantly submitting search requests when user is typing a search phrase. If you need to reduce the amount of requests sent to your server you can disable this features.
To disable the pop-up hint set the SearchAutocompleteEnable settings property to false:
SearchAutocompleteEnable: false
To disable the search results dynamic update set the SearchDynamicEnable property to false:
SearchDynamicEnable: false
Examples of DASL Search Requests
The IT Hit Ajax File Browser can submit two types of requests – to get data for pop-up and to get data for search results. To display the pop-up hint it will submit the following request:
SEARCH http://webdavserver.com/folder/ <?xml version="1.0"?> <searchrequest xmlns="DAV:"> <basicsearch> <select> <prop> <resourcetype/> <displayname/> <creationdate/> <getlastmodified/> <getcontenttype/> <getcontentlength/> <supportedlock/> <lockdiscovery/> <quota-available-bytes/> <quota-used-bytes/> <checked-in/> <checked-out/> </prop> </select> <where> <like> <prop> <displayname/> </prop> <literal>general%</literal> </like> </where> </basicsearch> </searchrequest>
The above request queries file names only. This is done to distinguish pop-up hint request from content search on the server side. You can optimize your WebDAV DASL server implementation to return pop-up hint request faster even though it may not be 100% accurate. You are free to query not only file names but file content, properties, etc.
To display the search results the Ajax File Browser submits the following request:
SEARCH http://webdavserver.com/folder/ <?xml version="1.0"?> <searchrequest xmlns="DAV:"> <basicsearch> <select> <prop> <resourcetype/> <displayname/> <creationdate/> <getlastmodified/> <getcontenttype/> <getcontentlength/> <supportedlock/> <lockdiscovery/> <quota-available-bytes/> <quota-used-bytes/> <checked-in/> <checked-out/> </prop> </select> <where> <or> <like> <prop> <displayname/> </prop> <literal>general%</literal> </like> <contains>general%</contains> </or> </where> </basicsearch> </searchrequest>
This request searches for file names and file content.
Using Wildcards
Ajax File Browser accepts regular wild cards used in most OS:
-
‘*’ – to indicate one or more character.
-
‘?’ – to indicate exactly one character.
The ‘*’ and ‘?’ characters are replaced with ‘%’ and ‘_’ characters to comply with DASL standard when submitted to the server.
If ‘%’, ‘_’ or ‘\’ characters are used in search phrase they are escaped with ‘\%’, ‘\_’ and ‘\\’.
To make the search behave similarly to how file system search functions Ajax File Browser will automatically add ‘%’ character at the end of the search phrase. To search for the exact match wrap the search phrase in double quotes: “my file”.