[KinoSearch] serializing safely

Marvin Humphrey marvin at rectangular.com
Wed Jun 13 21:48:49 PDT 2007


On Jun 13, 2007, at 11:57 AM, Hans Dieter Pearcey wrote:

> On Wed, Jun 13, 2007 at 11:50:32AM -0400, Hans Dieter Pearcey wrote:
>> Because my fastcgi (as so many others) has multiple children, my  
>> first instinct
>> is to store the searcher in the session so that any of the  
>> children can get at
>> it as needed.  I know that a bunch of the KS guts are XS or C,  
>> though; what
>> things can be safely Storabled and put into a database, and what  
>> things will
>> either blow up or silently not work?
>
> I answered at least part of my own question, namely that Searcher  
> can't be
> stored.  How do people usually handle this sort of thing?  My first  
> thought is
> to write something kind of like SearchServer and do simple RPC to  
> it from my
> application.

This is usual way to cache a Searcher with FastCGI:

   use CGI::Fast;
   use KinoSearch::Searcher;

   # load searcher once, outside loop
   my $searcher = KinoSearch::Searcher->new(
      invindex => Schema->open('/path/to/invindex'),
   );

   while ( my $cgi = CGI::Fast->new ) {
      process_search();
   }

If that doesn't work for you, can you you please illustrate how your  
app differs?

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/





More information about the kinosearch mailing list