updating a globally defined HTML scalar
opening the index ($INDEX) previously defined
creating a swish-e search object
setting the sort order
reading the query from the query string and searches
getting the number of returned hits
initializing a hit list
looping through each hit pulling out the desired properties for display
closing the hits list
The trickiest part of the routine is the definition of $detail. This variable holds the path to the found item (swishdocpath). By creating a hot link using this variable the user of the index is able to view the full re- cord.
To see how this works in real life:
Edit Apache's httpd.conf file.
Copy the xml-data/xhtml/marc2xhtml directory to Apache's htdocs directory.
Copy cgi-bin/xhtml.cgi to the htdocs directory.
Copy swish-indexes/xhtml.cfg to the htdocs directory.
Edit xhtml.cfg so IndexDir points to marc2xhtml (IndexDir marc2xhtml).
Edit xhtml.cfg so IndexFile outputs to xhtml.idx (IndexFile xhtml.idx).
Index marc2xhtml ( swish-e -c xhtml.cfg ).
Edit xhtml.cgi's first line so it points to Perl (Unix: #!/usr/bin/perl or Windows: #!c:\perl\bin\perl).
Open a command prompt and run xhtml.cgi from the command line. It should return a stream of
12. Finally, open your Web browser and point it to xhtml.cgi.
(If you have gotten this far, the breath a sigh of relief. That was the most complicated exercise, and it is all downhill from here.)
Improving display of search results
The search results of the XHTML index were rudimentary. In this exercise you will see how the swish-e properties (and therefore XML elements) can be displayed in greater detail. Mods.cgi implements this