| Main | Javadoc | Example |
|
|
This example uses a browse list to assist searching sources with a limited query term set (such as glossaries or thesauri). As its name implies, a browse list is a list of terms that can be browsed. It provides a means of rapid access to the set of words or phrases that are guaranteed to generate results. For example, in the simple search demo using the Shakespeare Glossary (see result parser demo for details on this source.), the user must know what term they are looking for and since the glossary only has about 2000 terms, the chances that the term will not be in the glossary or that the user will mispell the term are pretty good. Click on the Browse Terms button to see the browse list, then select an item and click "Search" to see what it meant in Shakespeare's time.
This example provides a search help feature using a BrowseLinkElementRenderer to generate a link on the search form that will pop up a BrowseResultsElementRenderer where the user can select a term. The selected term will then be inserted back into the original search form. This way, the user is guaranteed to get results because the browse list is built from the search source itself. (see the BrowseListOutputProcessor demo.)
The results display form used in this demo features a GetFormHyperlinkRenderer that converts the term into an online search so that the context in which the word is used by the Bard can be studied.
The HTMLScraperFilter demo enhances this demo by doing scraping the "search absoluteshakespeare.com" link and extracting snippets from play excerpts surrounding the target term.
<search:SearchForm
formName="ShakespeareFormWithBrowseLink"
categoryName="ShakespeareGlossary"
action="BrowseLinkElementRenderer.jsp"
/>
<results:DisplayForm
formName="ShakespeareBrowseTermDefinitionDisplayForm" />
<!-- ================================================================== -->
<!-- SearchForm for the enhanced Shakespeare Glossary lookup demo. -->
<!-- ================================================================== -->
<SearchForm name="ShakespeareFormWithBrowseLink" category="ShakespeareGlossary"
rendererClass="com.raritantechnologies.searchApp.taglibrary.SearchFormTableRenderer"
cellpadding = "0"
cellspacing = "1"
border = "0" >
<SearchElementRenderer rendererClass="com.raritantechnologies.searchApp.taglibrary.SearchFormRowRenderer"
valign="top" halign="left" >
<SearchElementRenderer rendererClass="com.raritantechnologies.searchApp.taglibrary.SearchFormColumnRenderer" >
<!-- ================================================================ -->
<!-- Displays the Term text input box with label -->
<!-- ================================================================ -->
<SearchElementRenderer
rendererClass="com.raritantechnologies.quickstart.taglibrary.forms.LabelElementRenderer"
label="Term" halign="left" valign="center" width="50" useTable="false" />
<SearchElementRenderer
rendererClass="com.raritantechnologies.quickstart.taglibrary.forms.TextInputElementRenderer"
fieldID="Term" initClear="false" width="25" />
<!-- ================================================================= -->
<!-- Renders the Button that will pop-up the browse list search form -->
<!-- ================================================================= -->
<SearchElementRenderer
rendererClass="com.raritantechnologies.quickstart.taglibrary.forms.BrowseLinkElementRenderer"
name="Browse"
action="browseShakespeareTerms.jsp"
features="width=500,height=320,left=200,top=200"
formName="document.forms.ShakespeareFormWithBrowseLink"
field="Term"
text="Browse Terms"
buttonOrLink="button" />
</SearchElementRenderer>
</SearchElementRenderer>
<SearchElementRenderer rendererClass="com.raritantechnologies.searchApp.taglibrary.SearchFormRowRenderer"
valign="top" halign="left" >
<SearchElementRenderer rendererClass="com.raritantechnologies.searchApp.taglibrary.SearchFormColumnRenderer" >
<SearchElementRenderer
rendererClass="com.raritantechnologies.quickstart.taglibrary.forms.SubmitButtonElement"
submitText="Search" />
</SearchElementRenderer>
</SearchElementRenderer>
</SearchForm>
<!-- ===================================================================== -->
<!-- Browse form to accompany above SearchForm. This form will appear -->
<!-- in a pop-up window. Clicking on one of the hyperlinked terms will -->
<!-- put the term into the input box of the ShakespeareFormWithBrowseLink -->
<!-- search form. -->
<!-- ===================================================================== -->
<SearchForm name="ShakespeareBrowseResults"
rendererClass="com.raritantechnologies.searchApp.taglibrary.SearchFormTableRenderer"
cellpadding = "0"
cellspacing = "1"
border = "0" >
<SearchElementRenderer rendererClass="com.raritantechnologies.searchApp.taglibrary.SearchFormRowRenderer"
valign="top" halign="left" >
<SearchElementRenderer rendererClass="com.raritantechnologies.searchApp.taglibrary.SearchFormColumnRenderer" >
<SearchElementRenderer
rendererClass="com.raritantechnologies.quickstart.taglibrary.forms.TextInputElementRenderer"
fieldID="Term" initClear="false" width="25" />
<SearchElementRenderer
rendererClass="com.raritantechnologies.quickstart.taglibrary.forms.SubmitButtonElement"
submitText="Go To" />
</SearchElementRenderer>
</SearchElementRenderer>
<!-- ==================================================================== -->
<!-- Reads in the browse list for the Shakespeare Glossary. -->
<!-- ==================================================================== -->
<SearchElementRenderer
rendererClass="com.raritantechnologies.quickstart.taglibrary.forms.BrowseResultsElementRenderer"
browseClass="com.raritantechnologies.searchApp.browse.Browse"
directory="BASE_PATH/data/ShakespeareGlossary/BrowseList/ShakespeareGlossary"
field="Term"
pageSize="15" nColumns="3" hitRow="3"
selectedText="Use Selected Values"
nonIndexedCharacters=" "
canceltext="Cancel"
buttonOrImage="button"
reloadOnExit="false" displayCount="false"
isPopup="true" pageControl="both"
scrollBackDisplay="<< previous"
scrollForwardDisplay="next >>" />
</SearchForm>
TableDisplayFormRenderer
<!-- ============================================================================= -->
<!-- Display form for ShakespeareFormWithBrowseLink -->
<!-- ============================================================================= -->
<DisplayForm name="ShakespeareBrowseTermDefinitionDisplayForm"
rendererClass="com.raritantechnologies.quickstart.taglibrary.TableDisplayFormRenderer" >
<ResultRenderer rendererClass="com.raritantechnologies.quickstart.taglibrary.ResultRowRenderer"
halign="left" name="termRow" >
<ResultRenderer rendererClass="com.raritantechnologies.quickstart.taglibrary.ResultColumnRenderer"
width="650" halign="left" name="Term">
<ResultRenderer rendererClass="com.raritantechnologies.quickstart.taglibrary.LabelRenderer"
width="150" halign="right" name="termLabel" >
<Label>Term:</Label>
</ResultRenderer>
<ResultRenderer rendererClass="com.raritantechnologies.quickstart.taglibrary.SimpleFieldRenderer"
width="500" halign="left" name="termField" defaultValue="" >
<Field ID="Term" />
</ResultRenderer>
</ResultRenderer>
<ResultRenderer rendererClass="com.raritantechnologies.quickstart.taglibrary.ResultColumnRenderer"
width="650" halign="left" name="Definition">
<ResultRenderer rendererClass="com.raritantechnologies.quickstart.taglibrary.LabelRenderer"
width="150" halign="right" name="definitionLabel" >
<Label>Definition:</Label>
</ResultRenderer>
<ResultRenderer rendererClass="com.raritantechnologies.quickstart.taglibrary.SimpleFieldRenderer"
width="500" halign="left" name="definitionField" defaultValue="" >
<Field ID="Definition" />
</ResultRenderer>
</ResultRenderer>
<ResultRenderer rendererClass="com.raritantechnologies.quickstart.taglibrary.ResultColumnRenderer"
width="650" halign="left" name="Search">
<ResultRenderer rendererClass="com.raritantechnologies.quickstart.taglibrary.LabelRenderer"
width="150" halign="right" name="definitionLabel" >
<Label>Search Web:</Label>
</ResultRenderer>
<!-- GetFormHyperlinkRenderer creates web search -->
<!-- hyperlink to www.shakespeare-online.com from -->
<!-- the value of the result 'Term' field. -->
<ResultRenderer
rendererClass="com.raritantechnologies.quickstart.taglibrary.GetFormHyperlinkRenderer"
width="500" title="Search Web" >
<Action>http://www.shakespeare-online.com/.search</Action>
<LabelRenderer rendererClass="com.raritantechnologies.quickstart.taglibrary.LabelRenderer"
width="500">
<Label>search shakespeare-online.com</Label>
</LabelRenderer>
<ParamField ID="Term" name="query"/>
</ResultRenderer>
</ResultRenderer>
</ResultRenderer>
</DisplayForm>