search two
Multifolder search v2.0
This file search script uses Xtscript and filelist to create a javascript object (associative array) of the results of multiple xt:filelist functions
This object is then sorted and dynamically paged and displayed using the DOM and javascript
The script retrieves the next page of results from the object without reloading the page from XtGem or rerunning the filelists.
This means much faster loading of the next results page and much less data usage
While they are created by the Xtscript the actual filelist functions are not run until after Xtscript has finished and are not subject to xtscript timeouts
This script has been tested with over 100 filelists searching over 12,000 files
If the query is a single word the search filter tests for a match anywhere in the filename
If the query has multiple words the spaces in the query are converted to * wildcards and the filter then tests for those words in that order with any other words or characters between them
There are also tests for invalid characters and query length
Settings
- per_page
Set the number of results per page
- min_query_length
Set the minimum query length
This should be no lower than 2 or you will return too many results 3 is about optimum depending on the shortest filename or other factors
- ext
This is appended to the filelist filter so that only files with extensions are included in the search
Query validation
This version is set up to search 10 folders if you need to extend it
1/ Insert another line like this into the Filelist patterns
var $list11 = xt:filelist folder="/folder11" $params
2/ Insert another filelist code into the array function before the
{_$$dummy|} entry
<{_$$list11|xt:code}>
In the demo below enter ** wildcard into the search to return all files
Example code
Example output