[KinoSearch] Devel package - cannot access indexed fields

Tamer Rizk trizk at inficron.com
Tue Feb 12 01:05:19 PST 2008


I was able to get search fully functional with a query parser and range
filter using KinoSearch devel 0.20_051 (2008-01-20) with perl v5.8.5 on
i386-linux the other day. I was, in fact, applying the docs at
http://www.rectangular.com/kinosearch/docs/devel/ to the dev release,
thanks. Using KinoSearch with InvIndex->finish(optimize=>1) on about
80MB of data, (dual Xeon 3.0GHz, 2G RAM), I am getting average 2.5 sec
search time including network latency when request/response as Ajax.

I tried to replicate the error (of no error messages) by bringing back
both the script and package to their former (non working) states from
memory, with no luck. Was using strict, no warnings. I then tried both:

my $reader = $searcher->get_reader;
my $lexicon = $reader->lexicon('summary');
die "no lexicon" unless $lexicon;
while ($lexicon->next) {
     print $lexicon->get_term->get_text;
     last;
}

and

my $reader = $searcher->get_reader;
my $lexicon = $reader->look_up_field('summary');
die "no lexicon" unless $lexicon;
while ($lexicon->next) {
     print $lexicon->get_term->get_text;
     last;
}

The former yields:
Can't locate object method "lexicon" via package
"KinoSearch::Index::SegReader"

and the latter: a term.

Since I want to search for a set of exact phrases, I am using the
PolyAnalyzer without the stemmer. With respect to the highlighter, it
does not do anything since upgrade to devel version. Using:

my $highlighter = KinoSearch::Highlight::Highlighter->new;
$highlighter->add_spec( field => 'summary' );
$hits->create_excerpts( highlighter => $highlighter );
...
print $hit->{excerpts}{summary};

I get the summary without highlights. Which, incidentally, is perfectly
okay because KinoSearch is an excellent piece of software. You are the man.

Thanks,
Tamer


Marvin Humphrey wrote:
> [OK, folks, I'm back in action.]
> 
> On Feb 9, 2008, at 6:39 AM, Tamer Rizk wrote:
> 
>> After building the InvIndex,  I need
>> to change the file permissions on _1.cf and segments_2.yaml (defaults to
>> 600).
> 
> This should no longer be necessary as of r2998.  Thanks for pointing it
> out.
> 
>> my $lex = $reader->lexicon( 'summary' ); #silently croaks
> 
> That's the interface for the current svn trunk.  The current CPAN dev
> release has a different interface, and Lexicon isn't even a public
> class.  You may have become confused by the fact that the docs at
> <http://www.rectangular.com/kinosearch/docs/devel/> reflect svn rather
> than the dev release.  I should probably change that.  For now, you
> might consult search.cpan.org:
> <http://search.cpan.org/~creamyg/KinoSearch-0.20_051/>.
> 
> Regardless, I'm surprised that the code above would silently croak. 
> There is no lexicon() method in 0.20_051, so you should see something
> like this, even without strict and warnings:
> 
>   Can't locate object method "lexicon" via package
>   "KinoSearch::Index::SegReader" at testy.pl line 12.
> 
> Try this and tell me what happens:
> 
>   my $lexicon = $reader->look_up_field('summary');
>   die "no lexicon" unless $lexicon;
>   while ($lexicon->next) {
>      print $lexicon->get_term->get_text;
>   }
> 
>> 'summary', and five other fields are defined as text in package KIndexer
>> within our %fields. I think default mode is index and vectorize. However
>> , searching (even with a simple term, no query parser) yields no hits,
>> the highlighter chokes (when implemented according to devel docs), and
>> fields seem to be undefined. Any ideas?
> 
> 
> One possibility is that you are searching for e.g. an unstemmed term
> when only the stemmed version exists in the index.  A search for "horse"
> will turn up empty if the index only contains the stemmed version "hors".
> 
> Also, I'm confused why error messages are not serving to guide you
> towards the correct path.  When you say that the highlighter "chokes",
> what do you see?
> 
> Marvin Humphrey
> Rectangular Research
> http://www.rectangular.com/
> 
> 
> _______________________________________________
> KinoSearch mailing list
> KinoSearch at rectangular.com
> http://www.rectangular.com/mailman/listinfo/kinosearch
> 



More information about the KinoSearch mailing list