Searching Issues

THL Toolbox > Developers' Zone > Searching Issues

Searching Issues

Contributor(s): Robbie Bingler, Than Grove

Topics on This Page:

Searching CatalogsTibetan Dictionary Search Forms

Searching THL Literature Catalogs from the Outside

Each of the catalogs in the THL Literary Encyclopedia (external link: http://www.thlib.org/encyclopedias/literary/) has its own search form from which one can search that particular catalog or the index of all texts. However, these search forms are within the catalog itself and rely heavily on Javascript and Ajax. So, it was not immediate possible to reverse engineer them into a GET call to perform a search from outside the catalog itself, either from another place within THL or from another site altogether. This issue has been address so it is now possible to call up a search on the catalogs. (Note: A true RESTful API where one can retrieve the data for a text in XML format through a URL still needs to be implemented and documented.)

The code that is now active on THL uses PHP to detect a param variable in the URL, creates a cookie of the query, and then redirects to the standard catalog URL. The JS in the catalog then detects the cookie and redirects to a subroutine that makes the search call and loads the results. For the record this involved changes to literary/canons/kt/catalog.php and literary/js/thl-catalog-controller.js. In its present inchoate state, the search param is called "q", and one can search for either Wylie or Tibetan. An example would be:

external link: http://www.thlib.org/encyclopedias/literary/canons/kt/catalog.php?q=chos

or

external link: http://www.thlib.org/encyclopedias/literary/canons/kt/catalog.php?q=ཆོས་

Note: Right now this is only available for the Kangyur-Tengyur catalog, but it will be implemented for other collections as well. The collection being searched is determined by the URL for the catalog.php page. The presently available collections are:

The available parameters in the search call are:

ParamValuesMeaning
q(any search string)The string to search for in the records
scope[text|bibl]Whether to search in digital texts or in the catalog bibliographic records
srchscope[all|coll|ed]Whether to search in all collections, the present collection being searched, or a specific edition
ed(the sigla for the edition being searched)This is not yet implemented but would be "d" or "tb", etc.

Search Forms for the Tibetan Dictionary

To make the search form work in any THL page, we use the following fields:

The action is a POST to:

external link: http://trinity.village.virginia.edu/THDLDictionary/definitions/find_head_terms

Provided for unrestricted use by the external link: Tibetan and Himalayan Library