The Options File
cThe option settings in dtsearch_options.html control the appearance of search results and retrieved files, generation of the synopsis, logging, and other options.
Each setting is bracketed with HTML comments, like this:
<!-- $Begin DocHeader -->
%%Filename%% (%%HitCount%% hits)
<!-- $End -->
The text that appears between the $Begin and $End comments has to be valid HTML. Text that is not between $Begin and $End comments is ignored, and can be used to insert explanatory comments.
Template Settings
Because dtsearch_options.html is a valid HTML file, you can edit it directly in an HTML editor to change the appearance of retrieved documents or search results. When editing the HTML, be careful to keep the $Begin and $End comments around each option setting.
Setting |
Purpose |
---|---|
DocHeader |
Text displayed above each retrieved document |
DocFooter |
Text displayed below each retrieved document |
DocScript |
JavaScript inserted in each retrieved document to enable hit navigation |
ResultsHeader |
Text displayed above each search results list |
ResultsFooter |
Text displayed below each search results list |
ResultsScript |
JavaScript inserted in each search results list to enable navigation between documents. |
BeforeHit |
Text displayed before each hit in a document |
AfterHit |
Text displayed after each hit in a document |
ResultsTableHeader |
Top row of search results table (for column labels) |
ResultsTableItem |
Format of each item in the search results table |
ResultsTableFooter |
End of search results table (generally </table>) |
In ResultsTableItem, the following symbols identify where document-related information is displayed:
Symbol |
Purpose |
---|---|
%%Hits%% |
Hit count |
%%PhraseCount%% |
Hit count, counting a phrase as a single hit |
%%HitsByWord%% |
List each word or phrase found in the search and the number of hits for each |
%%Filename%% |
Name of the retrieved document |
%%Synopsis%% |
Brief snippet of text showing the first hits in the document with a few words of context around each hit. See Synopsis Settings, below. |
%%Location%% |
Path to the retrieved document |
%%Date%% |
Modification date of the document |
%%SizeK%% |
Size of the document in kilobytes |
%%Size%% |
Size of the document in bytes |
%%Title%% |
Text from the first few lines of the document, or the TITLE of an HTML document |
%%DirectLink%% |
The string to be used for the HREF for an http: link to the document without hits highlighted (to directly open a file over a web connection) |
%%HighlightLink%% |
The string to be used for the HREF for a link to the document with hits highlighted |
%%LocalLink%% |
The string to be used for the HREF for a link to the local path to the document (for use with dtSearch Publish only) |
%%ThisDocOrdinal%% |
Sequential number of this item in the search results list (1, 2, 3, ...) |
The search results format can also include a string that tells dtSearch Web to include the search form at the end of the search results list. This string is:
%%Include{%%SearchForm%%}%%
Link Types
ResultsTableItem usually will contain one or more links to open the retrieved document. In these links, use %%DirectLink%%, %%HighlightLink%%, or %%LocalLink%% to specify the type of link you want. For example:
<a href="%%HighlightLink%%">%%Filename%%</a>
This would produce a link with the name of the document in the link. When clicked, the document would open with hits highlighted.
If you want to open the file without highlighting, to allow the native viewer for the file to open it, use either %%DirectLink%% or %%LocalLink%%. %%DirectLink%% produces a link to the file using http, and is appropriate for use over a web connection (example: https://www.example.com/documents/sample.doc). %%LocalLink%% produces a link to the location of the file on disk (example: c:\documents\sample.doc) and is appropriate for use in dtSearch Publish or to give users on a LAN direct access to files.
Option Settings
The options file also contains settings that control searching behavior and the way links and file information appear in search results.
Setting |
Purpose |
---|---|
MultiColorHighlighting |
Highlight each search term using a different color, instead of using one color for all terms |
HighlightColors |
Ten six-digit hex color codes to use as the highlighting colors if MultiColorHighlighting is enabled |
DisplayPdfAsText |
Display PDF files as plain text instead of using the browser's default PDF viewer. |
FieldWeights |
Specify the weight for hits that occur in fields. Example: subject:10, HtmlTitle:15 |
HtmlRemoveScripts |
Disable JavaScript in retrieved HTML files |
HtmlUseTitleAsName |
Use the Title of HTML files as the filename |
PdfUseTitleAsName |
Use the Title of PDF files as the filename |
MaxUrlSize |
Maximum size of a URL to generate |
MaxWordsToRetrieve |
Maximum number of words to match in a single search |
MaxWordsMessage |
Message to display when too many words matched |
UnconvertedTypes |
File types to display without conversion to HTML |
NoFilesMessage |
Message to display when no files are retrieved |
HighlightHttpDocs |
Highlight hits in documents indexed via HTTP (using the dtSearch Spider) |
HttpProxy |
Proxy server to use to access web resources |
SERVER_NAME |
Server address for the dtSearch Web server in search results. (Specify only if it is necessary to override the automatically-detected server name.) |
Synopsis Settings
The %%Synopsis%% symbol in search results represents a brief snippet of text including the first hits in each document, with a few words of context around each hit. The settings below provide options to customize how the synopsis is generated.
Performance
Generating a synopsis requires that dtSearch Web open the original document and scan through it to extract the text around each hit, which can be a time-consuming operation. To make generation of a synopsis faster, enabling caching of text when you create the index of the documents. For more information on this option, see "Caching Text" in the dtSearch Desktop help file.
Formatting
dtSearch Web will format the synopsis so it can be inserted into a search results table. Line breaks, paragraph formatting, colors, and extra spacing will all be removed to produce a simple snippet of text, with hits marked in bold.
Setting |
Purpose |
---|---|
SynopsisMaxContextBlocks |
Number of blocks of context to include in the synopsis. |
SynopsisContextHeader |
Text to include in front of each block of context. |
SynopsisWordsOfContext |
Number of words to include around each hit in the synopsis. |
SynopsisMaxWordsToRead |
Number of words in each document to scan looking for blocks of context to include in the synopsis. |
Log Settings
To enable logging in dtSearch Web, check the Log document access or Log searches checkboxes in the File tab of the Form Builder dialog box. This will set up the search form for default logging of search requests or document access. The options, like the options for document display, are controlled by a list of templates that you can customize by editing the generated options file.
Setting |
Purpose |
---|---|
LogSearches |
Set to 1 to enable logging of all search requests |
LogDocumentAccess |
Set to 1 to enable logging of document access |
DocumentLogNameTemplate |
Template used to generate the filename for the document access log |
DocumentLogItemTemplate |
Template used to generate a single entry in the document access log |
SearchLogNameTemplate |
Template used to generate the filename for the search log |
SearchLogItemTemplate |
Template used to generate a single entry in the search log |
The two filename templates, DocumentLogNameTemplate and SearchLogNameTemplate, are used to generate log filenames. By building date symbols into the log name, you can have a new log file start every day, month, or year. Example:
c:\logs\SearchLog%%Year%%-%%Month%%.log
The two item templates, SearchLogItemTemplate and DocumentLogItemTemplate, are used to generate the lines added to the log file. The following symbols can be used in the templates to customize the content of the logs:
Symbol |
Meaning |
---|---|
%%DateTime%% |
The date and time of the search |
%%Result%% |
"OK" if the request succeeded, "DENIED" if access was denied, "FAILED" on other errors |
%%REMOTE_USER%% |
The value of the REMOTE_USER HTTP variable (unless your site requires a login, it will be blank) |
%%REMOTE_ADDR%% |
The value of the REMOTE_ADDR HTTP variable (the IP address of the user accessing the site) |
%%DocName%% |
The name of the document accessed (document log only) |
%%SearchRequest%% |
The user's search request (search log only) |
%%FileConditions%% |
The value of the fileConditions form variable (search log only) |
%%BooleanConditions%% |
The value of the booleanConditions form variable (search log only) |
%%SearchIndex%% |
The index (or indexes) searched (search log only) |
%%DocCount%% |
The number of documents retrieved (search log only) |
%%Month%% |
The month of the search (01-12) |
%%Day%% |
The day of the search (01-31) |
%%Year%% |
The year of the search (4-digit) |
The log files are generated in CSV format, which you can import into Excel or most databases.