Leo Charre > Metadata-DB-Search-1.02 > Metadata::DB::Search

Download:
Metadata-DB-Search-1.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 1.02   Source   Latest Release: Metadata-DB-Search-1.05

NAME ^

Metadata::DB::Search - search the indexed metadata

SYNOPSIS ^

   use Metadata::DB::Search;
   use Metadata::DB;
   
   my $s = Metadata::DB::Search->new({ DBH => $dbh });

   $s->search({
      'age:exact'       => 24,
      'first_name:like' => 'jo',   
      'speed:morethan'  => 40,
   });

   $s->ids_count or die('nothing found');

   for(@$ids) {
      my $o = new Metadata::DB({ DBH => $dbh, id => $_ });   
   
   }

EXAMPLE 2 ^

   my $s = Metadata::DB::Search->new({ DBH => $dbh });
   
   $s->search_params_add( age => 24 );
   
   $s->search_params_add( 'first_name:like' =>'jo' );
   
   $s->search;

   my @matching_ids = @{ $s->ids };

   for my $id ( @matching_ids ){
   
      
   }

EXAMPLE 3 ^

What if you want to search other metadata table?

   $s->table_metadata_name('people');

   $s->search({
      'age:exact'       => 24,
      'first_name:like' => 'jo',   
   });

METHODS ^

search()

optional argument is a hash ref with search params these are key value pairs the value can be a string or an array ref

   $s->search({
      age => 25,
      'name:exact' => ['larry','joe']
   });

Possible search types for each attribute are like, exact, morethan, lessthan, default is like.

ids()

returns array ref of matching ids, results, in metadata table that meet the criteria

ids_count()

returns count of how many search results we have

search_params_add()

search_params_count()

returns how many search params we have

constriction_keys()

returns array ref of what the search params were for the search

_select_limit()

experimental, arg is number, may help speed up searches if set, possible num is 100?

SEE ALSO ^

Metadata::DB

CAVEATS ^

This is a work in progress.

BUGS ^

Please contact the AUTHOR of any bugs.

AUTHOR ^

Leo Charre leocharre at cpan dot org