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.

Query construction

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

  1. Filter out folders.
  2. Sort by the created time.
  3. 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:

which would:

  1. Select only the files in the folder (.files)
  2. Sort by creation time of the images (.ctime)
  3. Take the last 5 so the five most recent since we sorted by ctime (.last.5)
  4. Randomly sort these remaining 5 files (.shuffle)
  5. Pass them to the handler .gallery

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

Folder/List filters

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.

File filters

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.

General Sorters

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.jpg would have a nice name of just: fluffy Cat
reverse, rev
Reverse order of the natural sorting.
shuffle, random, rand
Random ordering.

Properties Sorters

filesize, size
Sort by file size.
Sort by the file/folder creations date/time.
Sort by the file/folder last modified date/time.