Gizmo Query Language
Gizmo has a simple query language for managing the content of the file system (i.e. files and folders). Since Gizmo does not use a database but the file systems as its content data source a simple query language has been devised. It allows the chaining of sorting and filtering commands to get lists of files/folders. It is only for querying the file system and not for modifying it which would go against the Gizmo security philosophy.
The GizQuery object is used to perform queries.
Querys are built by adding one of the filter or sorter commands in a list separated by a dot e.g.
They are executed from left to right so this command would
- Filter out folders.
- Sort by the created time.
- Return the first 5 items from this list.
Folder names can be querys
Yup, so you can name a folder, full of photos, as follows:
and it will randomly pick three of the image files and give them to whatever handler you have mapped to the "gallery" handler (which is the AD Gallery by default).
Folder names can include many combinations of filters and sorters. Heres another image gallery example:
- Select only the files in the folder (
- Sort by creation time of the images (
- Take the last 5 so the five most recent since we sorted by ctime (
- Randomly sort these remaining 5 files (
- Pass them to the handler
So you can see you can whittle down your list of files to get exactly what you want out the other end.
Sort and Filter commands
Here is a complete list of sort and filter commands available in the Gizmo Query Language
see: GizFilter class
This set of filters affects the list of files and does not look at the individual files at all.
- take the first n items.
- take the last n items.
- Randomly select n items
Note: If n is omitted then its assumed to be 1.
This set of filters looks at each file and does a comparison of some sort on ones of the files properties.
- File name contains the given string
- Filter out folders.
- Filter out files.
- A date filter. Files date is equal to or greater than YYYY-MM-DD. This can be abbreviated to YYYY-MM or YYYY.
- A date filter. Files date is equal to or less than YYYY-MM-DD. This can be abbreviated to YYYY-MM or YYYY.
see: GizFilter class.
These are for lists/folders and effect the way lists of files are returned.
See: GizSorter class.
- realname, rname
- Sort by file name in ascending order. This is the default sorting behavior.
- nicename, name
- Sort on the "nice name", that is the name with out the leading "01_" nor any extensions e.g.
03_fluffy_Cat.jpgwould have a nice name of just: fluffy Cat
- reverse, rev
- Reverse order of the natural sorting.
- shuffle, random, rand
- Random ordering.
- filesize, size
- Sort by file size.
- Sort by the file/folder creations date/time.
- Sort by the file/folder last modified date/time.