Zing::Search - Search Abstraction
Storage Search Abstraction
use Zing::Search; my $search = Zing::Search->new; # $search->query;
This package provides a storage search abstraction.
This package inherits behaviors from:
Zing::Entity
This package uses type constraints from:
Zing::Types
This package has the following attributes:
bucket(Str)
This attribute is read-only, accepts (Str) values, and is optional.
(Str)
handle(Str)
store(Store)
This attribute is read-only, accepts (Store) values, and is optional.
(Store)
symbol(Str)
system(Name)
This attribute is read-only, accepts (Name) values, and is optional.
(Name)
target(Str)
This package implements the following methods:
any() : Object
The any method returns a search to query for any handle, target, symbol and bucket.
handle
target
symbol
bucket
# given: synopsis $search = $search->any;
for(Str $type) : Object
The for method returns a search to query for any object of the given type within the defined handle and target.
# given: synopsis $search = $search->for('queue');
objects() : ArrayRef[Object]
The objects method returns a collection of objects derived from the query criteria.
# given: synopsis my $objects = $search->objects;
# given: synopsis use Zing::KeyVal; use Zing::PubSub; my $keyval = Zing::KeyVal->new(name => rand); $keyval->send({ sent => 1 }); my $pubsub = Zing::PubSub->new(name => rand); $pubsub->send({ sent => 1 }); my $objects = $search->objects;
process(CodeRef $callback) : Object
The process method executes the callback for each term in the search results.
callback
# given: synopsis $search = $search->process(sub { my ($term) = @_; });
query() : Str
The query method returns the query string used to produce search results.
# given: synopsis my $query = $search->query;
results() : ArrayRef[Str]
The results method performs a search and returns a collection of terms that meet the criteria.
# given: synopsis my $results = $search->results;
# given: synopsis use Zing::KeyVal; use Zing::PubSub; my $keyval = Zing::KeyVal->new(name => rand); $keyval->send({ sent => 1 }); my $pubsub = Zing::PubSub->new(name => rand); $pubsub->send({ sent => 1 }); my $results = $search->results;
using(Repo $repo) : Object
The using method modifies the search criteria to match the term of the provided repo or Zing::Repo derived object.
# given: synopsis use Zing::Queue; my $tasks = Zing::Queue->new(name => 'tasks'); $search = $search->using($tasks);
where(Str %args) : Object
The where method modifies the search criteria based on the arguments provided.
# given: synopsis $search = $search->where( handle => 'myapp', target => 'us-west', );
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install Zing, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zing
CPAN shell
perl -MCPAN -e shell install Zing
For more information on module installation, please visit the detailed CPAN module installation guide.