NAME
Pangloss::Search::Filter::Base - base class for collection filters
SYNOPSIS
# abstract - must be subclassed for use:
use Pangloss::Search::Filter::FooBar;
my $filter = new Pangloss::Search::Filter::FooBar()->set( $baz );
DESCRIPTION
An abstract search filter object for use with <Pangloss::Collection::Item>s.
METHODS
- $obj->item_keys
-
get/set this filter's hash of collection-item keys (see sub-classes for usage).
- $obj->keys
-
get the keys as a list.
- $bool = $obj->toggle( $key )
-
toggle given key, returns current state true => on, false => off.
- $obj = $obj->set( $key [, $key2 ... ] )
-
set given keys to on.
- $obj = $obj->unset( $key [, $key2 ... ] )
-
set given keys to off.
- $bool = $obj->is_set( $key )
-
test to see if the given key is set.
- $obj = $obj->reset
-
clear all set keys.
- $size = $obj->size
-
get number of keys currently set.
- $bool = $obj->is_empty
-
test to see if no keys are currently set.
- $bool = $obj->not_empty
-
test to see if any keys are currently set.
DEPRECATED
- $obj = $obj->add( $key [, $key2 ... ] )
- $obj = $obj->del( $key [, $key2 ... ] )
- $bool = $obj->exists( $key )
-
deprecated aliases to set, unset & is_set.
SUB-CLASSING
At the very least, you must do the following:
package Foo;
use base qw( Pangloss::Search::Filter::Base );
sub applies_to {
my $self = shift;
my $term = shift;
# use $term, $self->item_keys and the collections
# available via $self->parent to do your test
return 0 || 1;
}
AUTHOR
Steve Purkis <spurkis@quiup.com>
SEE ALSO
Known Sub-Classes
Pangloss::Search::Filter::Category, Pangloss::Search::Filter::Concept, Pangloss::Search::Filter::Language, Pangloss::Search::Filter::Proofreader, Pangloss::Search::Filter::Translator, Pangloss::Search::Filter::Status, Pangloss::Search::Filter::DateRange