chickadee » estraier-client » find-documents

find-documents base-uri node #!key phrase attr-phrases order max skip distinct depth wwidth hwidth awidth options auxiliary maskprocedure

Search for documents, using the options provided. If phrase is not supplied and attr-phrases is an empty list, zero documents are returned. Otherwise, phrase and attr-phrases must all match a document in order for it to be returned. In other words, phrase is ANDed with all the attr-phrases. The keys have the following meaning:

phrase
This is the search phrase which is matched against the documents (a string)
attr-phrases
These are the search phrases which are matched against the document attributes (a list of strings). This list can contain up to 10 search conditions, but not more. It defaults to the empty list.
order
The order in which the results should be returned (a string).
max
The maximum number of results returned (a number). If not supplied, it defaults to 10.
skip
The number of documents to skip in the result set (a number). Defaults to 0.
distinct
The attribute name on which to filter distinctly (a symbol or string).
depth
The depth of the meta-search (a number). Defaults to 0.
wwidth
The whole width (in characters) of search result snippets (a number). Default depends on server configuration. If zero, no snippets are returned. If negative, whole documents are returned.
hwidth
The width of strings (in characters) in the snippet in the beginning of the text (a number). Default depends on server configuration.
awidth
The width of strings (in characters) around the snipper (a number). Default depends on server configuration.
options
Options for the search condition. (TODO)
auxiliary
Permission to adopt result of the auxiliary index (a number). By default, it is 32. (TODO)
mask
The mask of search targets (a number). 1 means the node itself, 2 means the first link, 4 means the second link, 8 means the third link, and power values of 2 and their summation compose the mask. (TODO)

See the documentation for search conditions for information on the syntax of phrase, attr-phrases and order.

This procedure returns two values. The first value is a list containing the documents (the actual search results), the second value is a list with meta-information about the search result set.

The documents are pairs with the matched snippets (a list of pairs) as car and the attributes (an alist) as cdr. The car of a snippet is either a string to be highlighted (the part of the string that was in the search phrase) or #f if no appropriate highlighting can be made. The cdr of a snippet is a matched string.

Example:

(put-document "http://admin:admin@localhost:1978" "testnode"
              '("Hello there, this is another quick test") '((@uri . "test1")))
(find-documents "http://admin:admin@localhost:1978" "testnode"
                phrase: "quick test")
=>
((((#f . "Hello there, this is another ") ("quick test" . "quick test"))
  (#nodelabel . "testnode")
  (#nodescore . "10758")
  (#nodeurl . "http://localhost:1978/node/testnode")
  (@digest . "ec0e90969320452b97f55f97ad3a5cc7")
  (@id . "8")
  (@uri . "test1")))
((VERSION "1.0")
 (NODE "http://localhost:1978/node/testnode")
 (HIT "1")
 (HINT#1 "test" "1")
 (DOCNUM "1")
 (WORDNUM "8")
 (TIME "0.004907")
 (TIME#i "0.000597")
 (TIME#0 "0.000749")
 (LINK#0 "http://localhost:1978/node/testnode" "testnode" "10000" "1" "8" "9129518" "1")
 (VIEW "SNIPPET"))