Guest Blog Post from Ben Dotte, Widen Developer, regarding new enhancements to Quick Search functionality of Widen digital asset management and content management systems.
For the 5.2 release of Collective, we introduced a powerful new way to search for assets using operators and field prefixes.
Consider this example search:
filename:*.eps dateupdated:[01/01/2008 to 02/01/2008]
This translates to “the filename ends in .eps and the asset was updated between January 1, 2008 and February 1, 2008.”
But beyond simply providing a compact way to express advanced searches, this new search syntax is actually a mini language under the covers, defined using the powerful ANTLR parser generator. Using this technology enables the new search system to understand even the most complex searches like this one:
size:>5 (fn:(saas* *.jpg) or dm:[before 08/01/2008])
which means a filesize greater than 5 MB and (the filename starts with “saas” and ends in “.jpg” or the date modified is before August 1, 2008). Whew!
Besides being able to interpret very complex expressions, the language also defines order of operations. Much like in mathematics where multiplication takes precedence over addition in the expression 5 + 6 * 8, AND expressions take precedence over OR expressions. Which means that this search:
fall 2007 or fall 2008
is actually shorthand for this:
(fall and 2007) or (fall and 2008)
Processing a search is a two-step process. First, the text is converted into an Abstract Syntax Tree, or AST, that provides a complete representation of the search and any groupings. The AST for the previous example looks like this:
The second step is to walk this tree and translate it into a query that the system can understand, taking into account the location of each field and any security considerations.
This new search capability gives us the power and flexibility of a complete advanced search system packed into a concise, sleek new language. It serves as a foundation for the new quick search in the 5.2 release and will likely find its way into more and more search-related systems within the application in coming releases.