internal package Foswiki::Query::Node

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

internal package Foswiki::Query::Node is a Foswiki::Infix::Node

A Query object is a representation of a query over the Foswiki database.

Fields are given by name, and values by strings or numbers. Strings should always be surrounded by 'single-quotes'. Numbers can be signed integers or decimals. Single quotes in values may be escaped using backslash (\).

See QuerySearch for details of the query language. At the time of writing only a subset of the entire query language is supported, for use in searching.

A query object implements the evaluate method as its general contract with the rest of the world. This method does a "hard work" evaluation of the parser tree. Of course, smarter Store implementations should be able to do it better....

The "hard work" evaluation uses the getField method in the {Store}{QueryAlgorithm} to get data from the store. This decouples the query object from the detail of the store.

See Foswiki::Store::QueryAlgorithms for a full spec of the interface to query algorithms.

PUBLIC %aliases

A hash mapping short aliases for META: entry names. For example, this hash maps 'form' to 'META:FORM'. Published because extensions (search implementations) have made use of it in the past, though not part of the offical API.

This hash is maintained by Foswiki::Meta and is strictly read-only

PUBLIC %isArrayType

Maps META: entry type names to true if the type is an array type (such as FIELD, ATTACHMENT or PREFERENCE). Published because extensions (search implementations) have made use of it in the past, though not part of the offical API. The type name should be given without the leading 'META:'

This hash is maintained by Foswiki::Meta and is strictly read-only

evaluatesToConstant(%opts)

Determine if this node evaluates to a constant or not. "Constant" is defined as "anything that doesn't involve actually looking in searched topics". This function takes the same parameters (%domain) as evaluate(). Note that no reference to the tom or data web or topic will be made, so you can simply pass an arbitrary Foswiki::Meta.

simplify(%opts)

Simplify the query by spotting constant expressions and evaluating them, replacing the constant expression with an atomic value in the expression tree. This function takes the same parameters (%domain) as evaluate(). Note that no reference to the tom or data web or topic will be made, so you can simply pass an arbitrary Foswiki::Meta.

Topic revision: r1 - 19 Apr 2011, ProjectContributor
 
This site is powered by FoswikiCopyright &© by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Nustar Wiki? Send feedback