Документ взят из кэша поисковой машины. Адрес оригинального документа : http://oit.cmc.msu.ru/php/function.yaz-search.html
Дата изменения: Sun Feb 3 22:58:12 2002
Дата индексирования: Mon Oct 1 21:27:42 2012
Кодировка:
yaz_search

yaz_search

(PHP 4 )

yaz_search -- Prepares for a search

Description

int yaz_search ( int id, string type, string query)

yaz_search() prepares for a search on the target with given id. The type represents the query type - only "rpn" is supported now in which case the third argument specifies a Type-1 query (RPN). Like yaz_connect() this function is non-blocking and only prepares for a search to be executed later when yaz_wait() is called.

The RPN query

The RPN query is a textual represenation of the Type-1 query as defined by the Z39.50 standard. However, in the text representation as used by YAZ a prefix notation is used, that is the operater precedes the operands. The query string is a sequence of tokens where white space is ignored is ignored unless surrounded by double quotes. Tokens beginning with an at-character (@) are considered operators, otherwise they are treated as search terms.

Table 1. RPN Operators

SyntaxDescription
@and query1 query2intersection of query1 and query2
@or query1 query2union of query1 and query2
@not query1 query2query1 and not query2
@set nameresult set reference
@attrset set queryspecifies attribute-set for query. This construction is only allowed once - in the beginning of the whole query
@attr set type=value queryapplies attribute to query. The type and value are integers specifying the attribute-type and attribute-value respectively. The set, if given, specifies the attribute-set.

Example 1. Query Examples

Query
computer
matches documents where "computer" occur. No attributes are specified.

The Query
"donald knuth"
matches documents where "donald knuth" occur.

For the query
@attr 1=4 art
attribute type is 1 (Bib-1 use), attribute value is 4 Title), so this should match documents where art occur in the title.

Another more complex one:
@attrset gils @and @attr 1=4 art @attr 1=1003 "donald knuth"
The query as a whole uses the GILS attributeset. The query matches documents where art occur in the title and in which donald knuth occur in the author.