internal package Foswiki::Store::Interfaces::QueryAlgorithm

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::Store::Interfaces::QueryAlgorithm

Interface to query algorithms. Implementations of this interface are found in Foswiki/Store/*Algorithms.

The contract with query algorithms is specified by this interface description, plus the 'query' unit tests in Fn_SEARCH. The interface provides a default implementation of the 'getField' method, but all other methods are pure virtual and must be provided by subclasses. Note that if a subclass re-implements getField, then there is no direct need to inherit from this class (as long as all the methods are implemented).

ClassMethod new( $class, ) → $cereal

ObjectMethod query( $query, $webs, $inputTopicSet, $session, $options ) → $infoCache

  • $query - A Foswiki::Query::Node object
  • $web - name of the web being searched, or may be an array reference to a set of webs to search
  • $inputTopicSet - iterator over names of topics in that web to search
  • $session - reference to the store object
  • $options - hash of requested options
This is the top-level interface to a query algorithm. A store module can call this method to start the 'hard work' query process. That process will call back to the getField method in this module to evaluate leaf data in the store.

To monitor the hoisting and evaluation processes, use the MONITOR_EVAL setting in Foswiki::Query::Node

this is a default implementation of the query() sub that uses the specific algorithms' _webQuery member function.

StaticMethod getField($class, $node, $data, $field ) → $result

  • $class is this package
  • $node is the query node
  • $data is the indexed object
  • $field is the scalar being used to index the object
getField is used by the query evaluation code in Foswiki::Query::Node to get information about a leaf node, or 'field'. A field can be a name, or a literal, and the information it refers to can be a scalar, a reference to a hash, or a reference to an array. The exact interpretation of fields is context-dependant, according to reasonably complex rules best documented by the Fn_SEARCH unit test and QuerySearch.

The function must map the query schema to whatever the underlying store uses to store a topic. See QuerySearch for more information on the query schema.

StaticMethod getForm($class, $node, $data, $field ) → $result

  • $class is this package
  • $node is the query node
  • $data is the indexed object (must be Foswiki::Meta)
  • $formname is the required form name

StaticMethod getRefTopic($class, $relativeTo, $web, $topic, $rev) → $topic

  • $class is this package
  • $relativeTo is a pointer into the data structure of this module where the ref is relative to; for example, in the expression "other/'Web.Topic'" then $relativeTo is other.
  • $web the web; Web in the above example
  • $topic the topic; Topic in the above example
  • $rev optional revision to load
This method supports the Foswiki::Query::OP_ref and Foswiki::Query::OP_at operators by abstracting the loading of a topic referred to in a string.

StaticMethod getRev1Info($meta) → %info

Return revision info for the first revision in %info with at least:
  • {date} in epochSec
  • {author} canonical user ID
  • {version} the revision number

getListOfWebs($webnames, $recurse, $serachAllFlag) -> @webs

Convert a comma separated list of webs into the list we'll process TODO: this is part of the Store now, and so should not need to reference Meta - it rather uses the store.

Topic revision: r1 - 21 Nov 2014, 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 GSICS Wiki? Send feedback