Searching Issues
<h3 class="heading-h6"><a name="THLToolboxhomegtDevelopersZonegtSearchingIssues" class="anchorpoint"></a><a href="/tools/wiki/home.html">THL Toolbox</a> > <a href="/tools/wiki/Developers%27%20Zone.html">Developers' Zone</a> > Searching Issues</h3><p class="paragraph">
</p><h3 class="heading-h1"><a name="SearchingIssues" class="anchorpoint"></a>Searching Issues</h3><p class="paragraph"><strong class="bold">Contributor(s)</strong>: Robbie Bingler, Than Grove
</p><h3 class="heading-h6"><a name="TopicsonThisPage" class="anchorpoint"></a>Topics on This Page:</h3><p class="paragraph">
<table border="0" cellpadding="0" cellspacing="0" class="listHier lines"><tr><th scope="col"><a href="/tools/wiki/searching%20issues.html#cats">Searching Catalogs</a></th><th scope="col"><a href="/tools/wiki/searching%20issues.html#tibdic">Tibetan Dictionary Search Forms</a></th></tr></table></p><p class="paragraph"><a name="cats" class="anchorpoint"></a>
</p><h3 class="heading-h2"><a name="SearchingTHLLiteratureCatalogsfromtheOutside" class="anchorpoint"></a>Searching THL Literature Catalogs from the Outside</h3><p class="paragraph">Each of the catalogs in the THL Literary Encyclopedia (<img src="/" alt="external link: " title="external link"/><span class="nobr"><a href="http://www.thlib.org/encyclopedias/literary/" target="rwikiexternal">http://www.thlib.org/encyclopedias/literary/</a></span>) 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. (<strong class="bold">Note:</strong> 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.)</p><p class="paragraph">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:</p><p class="paragraph"><img src="/" alt="external link: " title="external link"/><span class="nobr"><a href="http://www.thlib.org/encyclopedias/literary/canons/kt/catalog.php?q=chos" target="rwikiexternal">http://www.thlib.org/encyclopedias/literary/canons/kt/catalog.php?q=chos</a></span></p><p class="paragraph">or</p><p class="paragraph"><img src="/" alt="external link: " title="external link"/><span class="nobr"><a href="http://www.thlib.org/encyclopedias/literary/canons/kt/catalog.php?q=" target="rwikiexternal">http://www.thlib.org/encyclopedias/literary/canons/kt/catalog.php?q=</a></span>ཆོས་</p><p class="paragraph"><strong class="bold">Note</strong>: 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:</p><ul class="star"><li><strong class="bold">Kangyur Tengyur</strong>: <img src="/" alt="external link: " title="external link"/><span class="nobr"><a href="http://www.thlib.org/encyclopedias/literary/canons/kt/catalog.php" target="rwikiexternal">http://www.thlib.org/encyclopedias/literary/canons/kt/catalog.php</a></span></li>
<li><strong class="bold">Nyingma Gyubum</strong>: <img src="/" alt="external link: " title="external link"/><span class="nobr"><a href="http://www.thlib.org/encyclopedias/literary/canons/ngb/catalog.php" target="rwikiexternal">http://www.thlib.org/encyclopedias/literary/canons/ngb/catalog.php</a></span></li>
<li><strong class="bold">Dingo Khyentse's Collected Works</strong>: <img src="/" alt="external link: " title="external link"/><span class="nobr"><a href="http://www.thlib.org/encyclopedias/literary/shechen/dkcw/catalog.php" target="rwikiexternal">http://www.thlib.org/encyclopedias/literary/shechen/dkcw/catalog.php</a></span></li></ul><p class="paragraph">The available parameters in the search call are:</p><p class="paragraph"><table border="0" cellpadding="0" cellspacing="0" class="listHier lines"><tr><th scope="col">Param</th><th scope="col">Values</th><th scope="col">Meaning</th></tr><tr class="table-odd"><td>q</td><td><em class="italic">(any search string)</em></td><td>The string to search for in the records</td></tr><tr class="table-even"><td>scope</td><td>[text|bibl]</td><td>Whether to search in digital <em class="italic">text</em>s or in the catalog <em class="italic">bibl</em>iographic records</td></tr><tr class="table-odd"><td>srchscope</td><td>[all|coll|ed]</td><td>Whether to search in <em class="italic">all</em> collections, the present <em class="italic">coll</em>ection being searched, or a specific <em class="italic">ed</em>ition</td></tr><tr class="table-even"><td>ed</td><td><em class="italic">(the sigla for the edition being searched)</em></td><td>This is not yet implemented but would be "d" or "tb", etc.</td></tr></table></p><p class="paragraph"><a name="tibdic" class="anchorpoint"></a>
</p><h3 class="heading-h2"><a name="SearchFormsfortheTibetanDictionary" class="anchorpoint"></a>Search Forms for the Tibetan Dictionary</h3><p class="paragraph">To make the search form work in any THL page, we use the following fields:
</p><ul class="star"><li><input type="text" name="term">Term</li>
<li><input type="hidden" name="mode" value="search"</li>
<li><input type="radio" name="search_field" value="tibetan" checked>Tibetan Unicode Script</li>
<li><input type="radio" name="search_field" value="wylie" >THL Wylie Transliteration</li>
<li><input type="radio" name="search_field" value="phonetic" >THL Phonetic Transcription</li>
<li><input type="radio" name="search_type" value="exact" >exact match</li>
<li><input type="radio" name="search_type" value="beginning" >starts with</li>
<li><input type="radio" name="search_type" value="anywhere" checked>contains</li></ul><p class="paragraph">The action is a POST to:</p><p class="paragraph"><img src="/" alt="external link: " title="external link"/><span class="nobr"><a href="http://trinity.village.virginia.edu/THDLDictionary/definitions/find_head_terms" target="rwikiexternal">http://trinity.village.virginia.edu/THDLDictionary/definitions/find_head_terms</a></span>
</p><h3 class="heading-h6"><a name="ProvidedforunrestrictedusebythespanclassnobrimgsrcsakairwikitoolimagesicklearrowgifaltexternallinktitleexternallinkahrefhttpwwwthliborgtargetrwikiexternalTibetanandHimalayanLibraryaspan" class="anchorpoint"></a><em class="italic">Provided for unrestricted use by the <span class="nobr"><img src="/" alt="external link: " title="external link"/><a href="http://www.thlib.org" target="rwikiexternal">Tibetan and Himalayan Library</a></span></em></h3>