Sorting Results Using Metadata
About this task
Certain types of metadata, such as the publication date stored in this tutorial's year metadata field, lend themselves to being used both as a searchable field and as a field that can be used to organize all of the results from a search collection. Mechanisms for sorting search results are typically identified by providing sortby:field as part of your query, where field identifies the mechanism that you want to sort by, known as a sort condition.
In Watson™ Explorer Engine, sort conditions are XPath expressions that you define on the form for the source associated with your search collection, which we edited in the Defining Fields for the Input Query.
Procedure
Results
If the window that displays your Watson Explorer Engine application is still open, you can refresh the screen (typically by pressing the F5 key or holding down the Control key while clicking the Reload icon. If you are reloading an existing window, make sure that no search terms or fields are still shown in the Search textbox at the top of the screen.
If the search results window is no longer open, you can re-display it by clicking Search under the search box in the Watson Explorer Engine administration tool's left-hand navigation bar.
When your application redisplays, it should initially appear to be unsorted. If necessary, click Turn off debugging to disable debugging and make it easier to see your search results. Next, enter the string sortby:year, and press return to see the same results which are now sorted by the metadata field year that contains the year in which the book associated with each result was published.
To proceed to the next section of this tutorial, click Fine-Tuning the Search Collection.