3. Simple Searching

The interface for simple searching provides a list of queries which have been previously run and saved (none in the screenshot below), and a button to create a new query.

Screenshot of CUD UI

A new query is built in a query builder screen which offers tools to set criteria for a commonly used subset of data stored in CUD.

Screenshot of CUD UI

Criteria can be set on attributes selected from a drop-down list (see Appendix A below for an explanation of these attributes), and an “equals” or “not equals” operator selected. Click the Add button every time a criteria is completed.

Screenshot of CUD UI

Criteria can be combined using the “AND” or “OR” operator (please note that you should also use parentheses when using the “OR” operator. You need to click the “Add” button to include such an operator in your search.

Screenshot of CUD UI

When all criteria are set, click the “Search” button to execute the search, which is run in the security context of the logged-in user. Results are displayed further down the page. We will save this query as “Demo query” so that we can run it again. A saved query is also assigned a reference which enables you and others to reference this query when using the web services interface.

Screenshot of CUD UI
Screenshot of CUD UI

We can now Edit/run the query to explore that formats in which data is available:

CSV:

Screenshot of CUD UI

XML in flat format:

Screenshot of CUD UI

XML in structured format:

Screenshot of CUD UI

See Appendix B for more information on data structures and formats.

More sophisticated queries can be built to provide result sets similar to those provided from the Registration database (until August 2012). Date fields can be search using the NOW function, to which days can be added or subtracted. When setting a criteria for University Card Expiry Date and Registration Expiry Date ranges of dates can be searched using the [<from> TO <end>] syntax, which can include wildcards. Combining these with [NOW TO *] will match all date fields with a date greater than or equals to today. Dates can be added to and subtracted from NOW in a way similar to the following examples:

NOW-1DAY

NOW+1DAY

NOW-1MONTH

NOW-2MONTHS

NOW-1YEAR

NOW+1YEAR

NOW-1YEAR+1MONTH

Further examples can be found at <http://lucene.apache.org/solr/api/org/apache/solr/util/DateMathParser.html>

Specific dates can be used, but these must be formatted correctly as ISO8601 yyyy-MM-ddThh:mm:ssZ such as 2012-01-31T12:00:00Z

The NOW function can only be used in date fields, of which the only two queryable in this interface are:

  • University Card Expiry Date
  • Username Expiry Date

Ranges without the NOW function can be used on other fields.

Solr/Lucene query syntax is used, to find out more about how criteria can be described http://wiki.apache.org/solr/SolrQuerySyntax is a good (if technical) starting point. Please note that not all filters and processors are enabled on CUD, so not everything will work as expected. You are encouraged to use the CUD UI interface to build and test queries.

Screenshot of CUD UI

Here is a query demonstrating the use of parentheses and the “OR” operator:

Screenshot of CUD UI

Up: Contents Previous: 2. Introduction Next: 4. Simple Matching