Home > Contents > Index > 
Template Tags TOC | Alpha TOC | Tag Family TOC | Purpose TOC | Annotated TOC | Index 
ics:search
Searches an index based on a query.
Syntax
<ics:search [index="index name"] searchterm="serach string" listname="output list" queryparser="parser name" relevanceterm="relevance term" [maxresults="max number of results"] [charset="character set"] [searchengine="name"]/>Parameters
index (optional)- Name of the index to search. Default is specified in the Content Server properties file.
 
searchterm (required)- Query to submit. This should be in the format the given search engine understands and may also depend on the
 queryparservalue.
listname (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
 searchtermparameter. Therelevancetermparameter is ignored.
- The combined syntax uses both types of syntax. A Boolean query is specified by the
 searchtermparameter and a simple query is specified by therelevancetermparameter 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 thesearchterm. 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
relevanceterm (optional for AltaVista)- Boolean term to be used for computing relevance ranking.
 
maxresults (optional)- Maximum number of results to return to the list.
 
charset (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 specifycharset, 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
 charset, 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
ics: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
<ics:clearerrno/> <ics:search index="c:/articleidx" list="headlist" what="headline:Clinton" searchengine="AV"/> <ics:if condition='<%ics.GetErrno() == 0%>'> <ics:then> <% IList il = ics.GetList("headlist", false);%> <ics:listloop listname="headlist"> <ics:selectto table="Article" what="*" where='<%=il.getValue("id")%' list="thearticle"/> <ics:if condition='<%ics.GetErrno() == 0%>'> <ics:then> <ics:listget listname="Article" fieldname="headline"/><br> <ics:listget listname="Article" fieldname="byline"/><br> </ics:then> </ics:if> </ics:listloop> </ics:then> </ics:if>
Note
This example requires that the database be accessed for each article. This can be inefficient, especially in 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 JSP Tag Reference
Copyright 2005,2006,2007 by FatWire Software
All rights reserved.