NAME

Zing::Search - Search Abstraction

ABSTRACT

Storage Search Abstraction

SYNOPSIS

use Zing::Search;

my $search = Zing::Search->new;

# $search->query;

DESCRIPTION

This package provides a storage search abstraction.

INHERITS

This package inherits behaviors from:

Zing::Entity

LIBRARIES

This package uses type constraints from:

Zing::Types

ATTRIBUTES

This package has the following attributes:

bucket

bucket(Str)

This attribute is read-only, accepts (Str) values, and is optional.

handle

handle(Str)

This attribute is read-only, accepts (Str) values, and is optional.

store

store(Store)

This attribute is read-only, accepts (Store) values, and is optional.

symbol

symbol(Str)

This attribute is read-only, accepts (Str) values, and is optional.

system

system(Name)

This attribute is read-only, accepts (Name) values, and is optional.

target

target(Str)

This attribute is read-only, accepts (Str) values, and is optional.

METHODS

This package implements the following methods:

any

any() : Object

The any method returns a search to query for any handle, target, symbol and bucket.

any example #1
# given: synopsis

$search = $search->any;

for

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.

for example #1
# given: synopsis

$search = $search->for('queue');

objects

objects() : ArrayRef[Object]

The objects method returns a collection of objects derived from the query criteria.

objects example #1
# given: synopsis

my $objects = $search->objects;
objects example #2
# 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

process(CodeRef $callback) : Object

The process method executes the callback for each term in the search results.

process example #1
# given: synopsis

$search = $search->process(sub {
  my ($term) = @_;
});

query

query() : Str

The query method returns the query string used to produce search results.

query example #1
# given: synopsis

my $query = $search->query;

results

results() : ArrayRef[Str]

The results method performs a search and returns a collection of terms that meet the criteria.

results example #1
# given: synopsis

my $results = $search->results;
results example #2
# 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

using(Repo $repo) : Object

The using method modifies the search criteria to match the term of the provided repo or Zing::Repo derived object.

using example #1
# given: synopsis

use Zing::Queue;

my $tasks = Zing::Queue->new(name => 'tasks');

$search = $search->using($tasks);

where

where(Str %args) : Object

The where method modifies the search criteria based on the arguments provided.

where example #1
# given: synopsis

$search = $search->where(
  handle => 'myapp',
  target => 'us-west',
);

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

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".

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues