Skip to main content.
home | support | download

Back to List Archive

Re: SWISH::API::Stat

From: Brad Miele <bmiele(at)not-real.ipnstock.com>
Date: Tue Nov 07 2006 - 02:46:55 GMT
hrm,

initial results as a direct dropin are return hit count but no row data.

here is my code, cleaned a bit of course :).

          my $swish = SWISH::API::Stat->new(
                                           indexes => $indexes,
                                           paranoia_level => 1,
                                           );
          if ($swish->Error){ print STDERR "SWISH:".$swish->ErrorString; }
          my $search = $swish->New_Search_Object( $query );
          $search->SetSort( $sort );

          $search->SetSearchLimit( 'sort_date', $low_stamp, $high_stamp ) if $datesearch;
          my $results = $search->Execute;
          my $num_results = $results->Hits;
          $results->SeekResult( $snum );

 	 while ( (my $result = $results->NextResult) && ($i <=  $max_ret) ) {
             my $res;
             my @props = $result->PropertyList; my $prop;
             foreach $prop(@props){
                $res->{$prop->Name}=$result->Property( $prop->Name );
             }
             push (@swish_return,$res);
             $i++;
          }

 	 return (\@swish_return);

doing some Data::Dumper tests, if you know it is something obvious...

Brad
---------------------
Brad Miele
VP Technology
IPNStock.com
866 476 7862 x902
bmiele@ipnstock.com

On Mon, 6 Nov 2006, Peter Karman wrote:

>
>
> Brad Miele scribbled on 11/6/06 8:18 PM:
>> Peter, a few questions,
>>
>> use SWISH::API::Stat;
>>          my $swish = SWISH::API::Stat->new(
>>                            log             => $filehandle,
>>                            indexes         => [ 'path/to/index' ],
>>                            paranoia_level  => 1
>>                            );
>>
>>
>> is log needed? I am pretty cautious about how much logging i do on my
>> production boxes, a bare minimum is the rule...
>>
>
> read SWISH::API::More:
>
> "Set to 0 to disable the default (but then don't expect logger() to work...)."
>
> If you don't disable the log() feature of S::A::S, it will print a timestamped
> message to stderr every time it reconnects, but that's about it.
>
>> currently, we scp the indexes into and incoming folder, mv them into
>> place, and reload apache. This worked for a while, but as our volume of
>> searches has increased, this is where we end up with stale index
>> filehandles and evergrowing httpd processes, so now we apachectl stop;
>> mv index; apachectl start; With SWISH::API::Stat, do you recommend a
>> reload after the indexes are copied into place?
>>
>
> You should not need to touch apache; that's the whole point of S::A::S. You can
> just mv your indexes into place, and the next time $swish_handle tries to access
> them, it should detect they've changed, and a new handle will be created.
>
> However, if you httpd processes are growing wildly, you may have a memory leak
> somewhere in your code (i.e., a Perl object that never gets destroyed because a
> reference to it persists somewhere). See the mod_perl docs about how to run
> under a debugger and a memory profiler.
>
>
> -- 
> Peter Karman  .  http://peknet.com/  .  peter(at)not-real.peknet.com
>
>
Received on Mon Nov 6 18:46:56 2006