aw schriftzug.png aw logo 60x60.png

internal package Foswiki::Contrib::DBCacheContrib::Search

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::Contrib::DBCacheContrib::Search

Search operators work on the fields of a Foswiki::Contrib::DBCacheContrib::Map.

Example

Get a list of attachments that have a date earlier than 1st January 2000
  $db = new Foswiki::Contrib::DBCacheContrib::DBCache( $web ); # always done
  $db->load();
  my $search = new Foswiki::Contrib::DBCacheContrib::Search("date EARLIER_THAN '1st January 2000'");

  foreach my $topic ($db->getKeys()) {
     my $attachments = $topic->fastget("attachments");
     foreach my $val ($attachments->getValues()) {
       if ($search->matches($val)) {
          print $val->fastget("name") . "\n";
       }
     }
  }

A search object implements the "matches" method as its general contract with the rest of the world.

new($string)

  • $string - string containing an expression to parse
Construct a new search node by parsing the passed expression.

toString() → string

Generates a string representation of the object.

--+++ =addOperator(%oper) Add an operator to the parser

%oper is a hash, containing the following fields:
  • name - operator string
  • prec - operator precedence, positive non-zero integer. Larger number => higher precedence.
  • arity - set to 1 if this operator is unary, 2 for binary. Arity 0 is legal, should you ever need it.
  • exec - the handler to implement the new operator

Topic revision: r1 - 2018-02-27, UnknownUser
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 Wiki? Send feedback