
henka at cityweb
Nov 2, 2007, 5:45 AM
Post #1 of 5
(1051 views)
Permalink
|
|
Playing with MultiSearcher framework
|
|
Hello, I've started playing around with MultiSearcher (MS) and have hit a snag. If you could shed some light on what I'm doing wrong, it would be appreciated. Given: kinosearch dev revision 2605 Each server has a basic ::SearchServer process running. Passwords, ports, etc all match. Searching on a single machine without MS works as expected. Searching using all machines with MS and with highlighting+sort results in errors (see below for more detail). Searching using all machines with MS but without highlighting+sort works fine - sans highlighting+sort effects of course. MultiSearcher code: ... use Test::Schema; use KinoSearch::Searcher; use KinoSearch::Highlight::Highlighter; use KinoSearch::Search::SortSpec; use KinoSearch::Search::MultiSearcher; # just include 'em all. use KinoSearch::Search::SearchServer; use KinoSearch::Search::SearchClient; ... my $sort_spec = KinoSearch::Search::SortSpec->new; $sort_spec->add( field => 'sort_field', reverse => 1, ); ... my $port=7890; my $pass = 'searchpw'; my @searchers; my @server_names = ( '10.1.1.10', '10.1.1.11', '10.1.1.12', ... ); my $schema = Test::Schema->new; for my $server_name (@server_names) { push @searchers, KinoSearch::Search::SearchClient->new( peer_address => "$server_name:$port", password => $pass, schema => $schema, ); } my $multi_searcher = KinoSearch::Search::MultiSearcher->new( searchables => \@searchers, schema => $schema, ); my $hits = $multi_searcher->search( query => $q, offset => $offset, num_wanted => $hits_per_page, sort_spec => $sort_spec, ); KinoSearch::Search::MultiSearcher->set_enable_sorting(1); # (A) #my $highlighter = KinoSearch::Highlight::Highlighter->new; #$highlighter->add_spec( field => 'body' ); #$highlighter->add_spec( field => 'title' ); #$hits->create_excerpts( ); #$hits->create_excerpts( highlighter => $highlighter ); ... Searching using the above code results in a "sort_spec not currently supported by MultiSearcher..." error no matter where I place (A). Commenting (ignorant quick-hack, I know) out: #confess("sort_spec not currently supported by MultiSearcher") # if ( $sort_spec and !$enable_sorting ); in /usr/lib/perl5/.../KinoSearch/Search/MultiSearcher.pm results in an error cascade starting with "Use of uninitialized value in read at...SearchClient.pm line 66, <GEN2> line 1.". This also kills the ::SearchServer process with the error "Can't locate object method "make_field_doc_collator" via package "KinoSearch::Se arch::SortSpec"...Searcher.pm line 62, <GEN2> line 3.". Commenting out all the sort code, but enabling the highlighter code, results in the error: "Can't call method "set_terms" on an undefined value at...Search/Hits.pm line 73, <GEN2> line 1." Commenting out all the sort and highlighter code results in successful searching across all search nodes (but without sorting and highlighting of course). Sorry for long rambling post. Any pointers would be appreciated. Regards Henry _______________________________________________ KinoSearch mailing list KinoSearch [at] rectangular http://www.rectangular.com/mailman/listinfo/kinosearch
|