Home > Contents > Index >
SEARCH
Searches an index based on a query.
Syntax
<SEARCH [INDEX="INDEX_NAME"] WHAT="SEARCH_STRING" [LIST="OUTPUT_LIST"] QUERYPARSER="PARSER NAME" RELEVANCE="RELEVANCE" [LIMIT="MAX_NO_RESULTS"] [CHARACTERSET="CHAR_SET"] [SEARCHENGINE="NAME"]/>Parameters
INDEX (optional)
- Name of the index to search. Default is specified in the Content Server properties file.
WHAT (required)
- Query to submit. This should be in the format the given search engine understands and may also depend on the
QUERYPARSER
value.
LIST (required)
- Name of the output list. Columns returned are:
ENTRY
- Name of the index entry that matches the search criteria.DETAIL
- Details of the index entry that matches the search criteria.DATE
- Date the entry was added or the date specified when the index was added. Format is in Java SQL.RELEVANCE
- Relevance value associated with the search result. The closer the value is to 1, the more useful and relevant the search result is likely to be.QUERYPARSER (optional for Verity)
- The AltaVista search engine supports three search types--
Simple
,Advanced
, andCombined
.Advanced
is the default, and was previously the only one supported.
- The simple search syntax uses optional + or - signs on a word or phrase to indicate that it is required or prohibited in the search results. The Advanced syntax uses Boolean operators (such as and, or, not, near) to constrict complex queries. In both cases, the query is passed in the
WHAT
parameter. TheRELEVANCE
parameter is ignored.
- The combined syntax uses both types of syntax. A Boolean query is specified by the
WHAT
parameter and a simple query is specified by theRELEVANCE
parameter to determine the ranking order of the results.
- The Verity search engine supports three query parsers--
Simple
,FreeText
, andBoolPlus
. The optionalQUERYPARSER
tag tells the Verity search engine the syntax of theWHAT
clause. If this argument is omitted, then the Simple parser is used by default. The parser may be specified by theverity.parser
property in thefuturetense.ini
file. The choice of parser determines the syntax and form of the query
RELEVANCE (optional for AltaVista)
- Boolean term to be used for computing relevance ranking.
LIMIT (optional)
- Maximum number of results to return to the list.
CHARACTERSET (optional)
- Constant value representing the character set the index uses.
- For the AltaVista search engine this value can be
0
,1
, or2
(ISO_LATIN1, ASCII8, UTF8). If you do not specifyCHARACTERSET
, Content Server uses the value ofav.charset
from the Content Server properties file.
- Because Java Strings are transformed to UTF8, as they pass through the JNI interface to AltaVista, the 0 value only works for 7-bit ASCII. For all other cases, use the value for UTF8.
- For the Verity search engine, this value specifies the name of the subdirectory of the common directory where the locale is defined. If you do not specify
CHARACTERSET
, Content Server uses the value ofverity.charset
in the Content Server properties file.
SEARCHENGINE (optional)
- Name of the search engine to use. If
SEARCHENGINE
is not specified, Content Server uses the value ofcs.searchengine
from the Content Server properties file.
Description
The
SEARCH
tag searches an index based on a query. The resultset of the query is stored in a list.errno
The possible values of
errno
include:
Value Description -101 No search results. -800 Bad search type. -801 Cannot load search engine. -802 Unsupported search function. -805 No default index specified. -806 Unknown search engine. -809 Search failed. -810 Bad character set. -811 Could not call native method. -812 Index does not exist.Example
This example searches the existing index in
c:ArticleIndex
for headlines with the nameClinton
in them. If any are found, then the search result list is looped over and the headline and the author are displayed. Since this information is not directly available from the index, theENTRY
field of the search result list is used to lookup the article entry in the appropriate database table and the required fields are obtained from the database record for the article.
<SETVAR
NAME="errno" VALUE="0" /> <SEARCH INDEX="C:/ArticleIdx" LIST="headlist" WHAT="headline:Clinton" SEARCHENGINE="AV" /> <ICS.ARGUMENT
COND="Variables.errno=0"> <THEN> <RENAMELIST
LIST="headlist"> <SETVAR
NAME="id" VALUE="headlist.ENTRY" /> <SELECTTO
FROM="Variables.tablename" WHAT="*" WHERE="Variables.id" LIST="thearticle" /> <CSVAR
NAME="thearticle.headline" /><BR/> <CSVAR
NAME="--by thearticle.byline"/> <BR/> </LOOP> </THEN> </IF>
Note
This example requires that the database be accessed for each article. This can be inefficient, especially in those cases where the search results are to be displayed only so that the one element required may be selected for further use. In this case, you should use the
DETAIL
field of the search result list. When entries are added to the index, you should set theDETAIL
parameter to some useful text string. For this example, it could be set to the article title so that you can then display and use it to select the article of interest.See Also
Home > Contents > Index > ![]()
FatWire XML Tag Reference
Copyright 2005,2006,2007 by FatWire Software
All rights reserved.