Highlighting Results of Searches in SharePoint Portal Server. By Serge van den Oever, Macaw. Hit-highlighting as available with IndexServer is provided through a DLL called webhits.dll. This is an ISAPI filter that handles pages with the extension ".htw". These are ordinary HTML pages where some special tags in the form <%xxx%> are allowed and those tags are replaced with result information. The ".htw" extension seems to be an acronym for "HTML with Webhits extensions". The ".htw" pages get as parameters some values to indicate: a.. the URL of the document to do hit-highlighting on b.. the locale of the document c.. the way to format the highlighted text d.. the query itself e.. application specific parameters The webhits.dll ISAPI filter is available on a standard Windows 2000 server installation. The query is executed on the default search engine available on the operating system. This is indexserver on Windows NT4, and the Indexing Service on Windows 2000. The query syntax for the Indexing Service is completely different from the syntax for the Search of SharePoint Portal Server. This is also where the difficulty in implementation is. From the same information entered into the search webpart, two different queries must be created: for SharePoint search and for the Indexing Service. In the current implementation of the search webpart the query for SharePoint is already built, and it is impossible to extract the appropriate information for the Indexing Service query. The search webpart must be modified to pass the information needed to build the query for the Indexing Service, or it must build this query itself. Another issue is the locale of the document. In the current tests some strange issues occurred with respect to the locale. English words are always matched correctly, for example "catch*" matches "catching" and "catches", but with the Dutch locale "document*" did not match "documenten". Further investigation is needed. We already did a proof of concept for hit-highlighting. To show the way hit-highlighting works, the code of our proof of concept is given in the following section. 1.1 Implementation of hit-highlighting The first file is the HTML page with links to summary hit-highlighting (only the parts of text matching the query are shown with the words matching the query highlighted) and full hit-highlighting (the complete text is shown without formatting, words matching the query are highlighted, navigation to next and previous hit is available within the text). Test.asp <% Dim WebHitsQuery ' Define the file to highlight using the CiWebHitsFile parameter WebHitsQuery = "CiWebHitsFile=" & Server.URLEncode("/hit/test.doc") WebHitsQuery = WebHitsQuery & "&CiLocale=1043" WebHitsQuery = WebHitsQuery & "&CiRestriction=" & Server.URLEncode("search**") ' Define the formatting for the query results WebHitsQuery = WebHitsQuery & "&CiBeginHilite=" & Server.URLEncode( "" ) WebHitsQuery = WebHitsQuery & "&CiEndHilite=" & Server.URLEncode( "" ) QueryForm = Request.ServerVariables("PATH_INFO") WebHitsQuery = WebHitsQuery & "&CiUserParam3=" & QueryForm %> Highlight Summary
Highlight Full The above file refenreces two ".htw" files, for summary and full hit-highlighting. qsumrhit.htw <%CiRestriction%> in <%CIURL%>

Condensed Hit Highlighting Form

Query <%CiRestriction%> against document <%CiUrl%>.

Short excerpts immediately before and after each hit within the document are displayed.

New Query


<%begindetail%><%enddetail%>
qfullhit.htw <%CiRestriction%> in <%CIURL%>

Full Hit Highlighting Form

Query <%CiRestriction%> against document <%CiUrl%>

You can navigate between the hits using the "<<" and ">>" tags around a hit. Clicking "<<" takes you to the previous hit, clicking ">>" takes you to the next hit.

Click to go to the first hit in the document.

New Query


<%begindetail%><%enddetail%>