| Main | Javadoc | Example |
|
|
This class is used to generate a Browse List for the set of Shakespeare Glossary terms. This example also uses a QueryProcessorGateway to generate a set of browse results for processing into a browse list. It also uses the same SearchSource used to generate the live Shakespeare Glossary used in other demos (see the result parser demo for more information on how this source is created.)
The BrowseList generator process can either be managed within a web application using the Scheduler or run as a standalone process.
A user interface that uses the Browse list created by this build process is shown in the BrowseLinkElementRenderer demo.
Another example of a BrowseList build is shown in the ResultMatcherFilter demo. In this case, a BrowseList is built on the Framework Module Tree (seen to the left). The ResultMatcherFilter is used to extract nodes that correspond to Framework Module classes. A User interface to this browse list is shown in the BrowseResultsElementRenderer demo.
<BrowseListBuild>
<!-- ================================================================================= -->
<!-- The CollectionGateway is responsible for collecting a set of IResultSets from -->
<!-- from some source. The QueryProcessorGateway uses an RTI SearchSource to get -->
<!-- results by way of a Query constructed in this configuration. -->
<!-- ================================================================================= -->
<CollectionGateway name="GlossarySearch"
class="com.raritantechnologies.verity.collection.QueryProcessorGateway"
pageSize="50" >
<QueryList>
<Query>
<Field ID="sortBy" value="Term" />
<Field ID="sortDir" value="asc" />
</Query>
</QueryList>
<!-- ================================================================== -->
<!-- Collect all of the terms in the ShakespeareGlossary Search Source -->
<!-- ================================================================== -->
<Sources>
<Source name="ShakespeareGlossary" />
</Sources>
</CollectionGateway>
<!-- ================================================================================= -->
<!-- The GatewayOutputProcessor takes the IResultSets generated by the -->
<!-- CollectionGateway and processes them. The BrowseListOutputProcessor generates -->
<!-- a set of Browse files from the Term data. -->
<!-- ================================================================================= -->
<GatewayOutputProcessor class="com.raritantechnologies.searchApp.browse.BrowseListOutputProcessor"
resultField="Term"
browseField="Term"
searchSourceName="ShakespeareGlossary"
newBrowseList="true"
oneCountPerRecord="true" >
<BrowseListWriter class="com.raritantechnologies.searchApp.browse.FileBrowseListWriter"
directoryPath="C:/Program Files/Apache Group/Tomcat 4.1/webapps/FrameworkDocumentation/data/ShakespeareGlossary/BrowseList" />
</GatewayOutputProcessor>
<!-- =========================================================================================== -->
<!-- Builds an in-memory glossary of terms used by Shakespeare. Used by tagging string filter -->
<!-- to provide a 'click-on' definition feature for annotating Shakespeare passages. The data -->
<!-- is from the Absolute Shakespeare web site (http://absoluteshakespeare.com) -->
<!-- =========================================================================================== -->
<SourceType name="ShakespeareGlossary" type="InMemorySearchSource"
displayName="Shakespeare Glossary"
sourceFactoryClass="com.raritantechnologies.searchApp.FlatFileMemorySourceFactory"
queryProcessor="com.raritantechnologies.searchApp.InMemorySearchSource"
sourceName="ShakespeareGlossary"
delimiter="|"
blankQueryReturnsAll="true"
caseSensitive="false" >
<Columns>
<Column ID="GlossaryTerm" />
</Columns>
<Files>
<File name="C:/Program Files/Apache Group/Tomcat 4.1/webapps/FrameworkDocumentation/data/ShakespeareGlossary/Glossary_A-F.txt" />
<File name="C:/Program Files/Apache Group/Tomcat 4.1/webapps/FrameworkDocumentation/data/ShakespeareGlossary/Glossary_G-K.txt" />
<File name="C:/Program Files/Apache Group/Tomcat 4.1/webapps/FrameworkDocumentation/data/ShakespeareGlossary/Glossary_L-P.txt" />
<File name="C:/Program Files/Apache Group/Tomcat 4.1/webapps/FrameworkDocumentation/data/ShakespeareGlossary/Glossary_Q-T.txt" />
<File name="C:/Program Files/Apache Group/Tomcat 4.1/webapps/FrameworkDocumentation/data/ShakespeareGlossary/Glossary_U-Z.txt" />
</Files>
<!-- =================================================================== -->
<!-- The Field Formatter will be used to format the raw results obtained -->
<!-- from the flat files before inserting the metadata into the search -->
<!-- source. We use a ResultParserFormatter and regular expressions -->
<!-- to break up each line into a 'Term' and 'Description' field. -->
<!-- (Normally, the flat file would contain a delimiter that we could -->
<!-- use to parse the line, but this data does not have a reliable -->
<!-- delimiter, so we need to improvise.) -->
<!-- =================================================================== -->
<FieldFormatter class="com.raritantechnologies.searchApp.formatters.ResultParserFormatter" >
<ResultParser class="com.raritantechnologies.searchApp.formatters.StringPatternResultParser"
fieldID="GlossaryTerm"
initialState="AT_LINE" >
<!-- String filters that can transform a text line into metadata fields -->
<FilteredField state="AT_LINE"
fieldID="Term" >
<!-- Find patterns of "'ALL-CAPS, lowercase ..." or "ALL, CAPS, lowercase ..." -->
<!-- with the ALL CAPS section as the Term field. -->
<StringFilter class="com.raritantechnologies.utils.filter.RegExprStringFilter" >
<Pattern inPattern="([A-Z\-\']*), ([A-Z\s\-\']*), ([a-z]*)(.*)"
outPattern="$2 $1" />
<Pattern inPattern="([A-Z\s\-\']*), ([a-z]*)(.*)"
outPattern="$1" />
</StringFilter>
</FilteredField>
<FilteredField state="AT_LINE"
fieldID="Definition" >
<!-- Find patterns of "'ALL-CAPS, lowercase ..." or "ALL, CAPS, lowercase ..." -->
<!-- with the lowercase ... section as the Description field. -->
<StringFilter class="com.raritantechnologies.utils.filter.RegExprStringFilter" >
<Pattern inPattern="([A-Z\-\']*), ([A-Z\s\-\']*), ([a-z])(.*)"
outPattern="$3$4" />
<Pattern inPattern="([A-Z\s\-\']*,) ([a-z])(.*)"
outPattern="$2$3" />
</StringFilter>
</FilteredField>
</ResultParser>
</FieldFormatter>
</SourceType>
</BrowseListBuild>