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
QUERYPARSERvalue.
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.Advancedis 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
WHATparameter. TheRELEVANCEparameter is ignored.
- The combined syntax uses both types of syntax. A Boolean query is specified by the
WHATparameter and a simple query is specified by theRELEVANCEparameter to determine the ranking order of the results.
- The Verity search engine supports three query parsers--
Simple,FreeText, andBoolPlus. The optionalQUERYPARSERtag tells the Verity search engine the syntax of theWHATclause. If this argument is omitted, then the Simple parser is used by default. The parser may be specified by theverity.parserproperty in thefuturetense.inifile. 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.charsetfrom 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.charsetin the Content Server properties file.
SEARCHENGINE (optional)- Name of the search engine to use. If
SEARCHENGINEis not specified, Content Server uses the value ofcs.searchenginefrom the Content Server properties file.
Description
The
SEARCHtag searches an index based on a query. The resultset of the query is stored in a list.errno
The possible values of
errnoinclude:
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:ArticleIndexfor headlines with the nameClintonin 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, theENTRYfield 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.
<SETVARNAME="errno" VALUE="0" /> <SEARCH INDEX="C:/ArticleIdx" LIST="headlist" WHAT="headline:Clinton" SEARCHENGINE="AV" /> <ICS.ARGUMENTCOND="Variables.errno=0"> <THEN> <RENAMELISTLIST="headlist"> <SETVARNAME="id" VALUE="headlist.ENTRY" /> <SELECTTOFROM="Variables.tablename" WHAT="*" WHERE="Variables.id" LIST="thearticle" /> <CSVARNAME="thearticle.headline" /><BR/> <CSVARNAME="--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
DETAILfield of the search result list. When entries are added to the index, you should set theDETAILparameter 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.