NAME
KinoSearchX::Simple - Simple KinoSearch1 Interface, inspired by Plucene::Simple
SYNOPSIS
use KinoSearchX::Simple;
my $searcher = KinoSearchX::Simple->new(
'index_path' => '/tmp/search_index',
'schema' => [
{
'name' => 'title',
'boost' => 3,
},{
'name' => 'description',
},{
'name' => 'id',
},
],
'search_fields' => ['title', 'description'],
'search_boolop' => 'AND',
);
$searcher->create({
'id' => 1,
'title' => 'fibble',
'description' => 'wibble',
});
#important - always commit after updating the index!
$searcher->commit;
my ( $results, $pager ) = $searcher->search( 'fibble' );
DESCRIPTION
Simple interface to KinoSearch1. Use if you want to use KinoSearch1 and are lazy :p
FUNCTIONS
search( $query_string, $page ) - search index
my ( $results, $pager ) = $searcher->search( $query, $page );
create( $document ) - add item to index
$searcher->create({
'id' => 1,
'title' => 'this is the title',
'description' => 'this is the description',
});
update_or_create( $document, $pk, $pv ) - updates or creates document in the index
$searcher->update_or_create({
'id' => 1,
'title' => 'this is the updated title',
'description' => 'this is the description',
}, 'id', 1);
$pk defaults to 'id' $pv defaults to $document->{'id'} if not provided
delete( $key, $value ) - remove document from the index
$searcher->delete( 'id', 1 );
finds $key with $value and removes from index
commit() - commits and optimises index after adding documents
$searcher->commit();
you must call this after you have finished adding items to the index
ADVANCED
when creating the KinoSearchX::Simple object you can specify some advanced options
language
set's language for default _analyser of KinoSearch1::Analysis::PolyAnalyzer
_analyser
set analyser, defualts to KinoSearch1::Analysis::PolyAnalyzer
search_fields
fields to search by default, takes an arrayref
search_boolop
can be OR or AND
search boolop, defaults to or. e.g the following query
"this is search query"
becomes
"this OR is OR search OR query"
can be changed to AND, in which case the above becomes
"this AND is AND search AND query"
resultclass
resultclass for results, defaults to KinoSearchX::Simple::Result which creates acessors for each key => value returned
entries_per_page
default is 100
SUPPORT
Bugs should always be submitted via the CPAN bug tracker
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=KinoSearchX-Simple
For other issues, contact the maintainer
AUTHORS
n0body <n0body@thisaintnews.com>
SEE ALSO
http://thisaintnews.com, KinoSearch1, Data::Page, Moose
COPYRIGHT
Copyright 2010 n0body http://thisaintnews.com/ . All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as perl itself.