logo

XApperator

lightweight, manouverable and quickly deployed

Searching

Although XApperator is more focused on data management than consumer focused actions like search it does provide a means for searching your XML files and displaying results in a custom XSLT transform using the controller cgi script

Search is enabled by setting the boolean attribute @enabled of the /actions/search/ element to '1' in the config.xml file for your application. You should also specify the XSLT template to be used (defaults to search.xslt) using the @transform attribute.

XApperator looks for any fields in the schema part of the config.xml file that have searchable="1" set and will do a simple text search of each keyword in the search string against the raw text value of the searchable nodes from the datasets of your application.

Following is some sample XSLT which would display the name and description elements of records returned by a search, and present a form before the results with a sticky value for the last search entered (via the $fkey parameter which XApperator passes into the transform)

The demo application distributed with XApperator has a sample search.xslt and a config file specifically for search mode. This additional config file disables all other editing modes so that it can be used to provide search to end-users without exposing editing actions to them.

You should create a copy of your controller.cgi script for search-only access to the application and hard-code the @configFile attribute of the XApperator instance to point to the search-only config file name

Please note: you need to be careful about employing the search method when your datasets contain a large number of records. XApperator parses each XML file in your dataset and crawls through the DOM for the XML in those files performing the search. This will not scale well to large collections and you should consider a search engine crawl of the published site as an alternative.


Authored using: XApperator