Changeset 6665


Ignore:
Timestamp:
03/07/10 01:57:57 (3 years ago)
Author:
SvenDowideit
Message:

Item8643: remove the 'optimisation' that we keep the Parser object around forever - which prettymuch ensures we don't notice a change to this setting in any cached (mod_perl, fastcgi, standalone) obj.

Location:
trunk/core/lib/Foswiki
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/lib/Foswiki/Infix/Parser.pm

    r5809 r6665  
    8787 
    8888    return $this; 
     89} 
     90 
     91=begin TML 
     92 
     93---++ ObjectMethod finish() 
     94Break circular references. 
     95 
     96=cut 
     97 
     98sub finish { 
     99    my $self = shift; 
     100 
    89101} 
    90102 
     
    218230                print STDERR "Tok: qs '$1'\n" if MONITOR_PARSER; 
    219231                my $val = $2; 
     232 
    220233                # Handle escaped characters in the string 
    221234                $val =~ s/(?<!\\)\\(.)/$1/g; 
     
    310323Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/, http://Foswiki.org/ 
    311324 
    312 # Copyright (C) 2008-2009 Foswiki Contributors. All Rights Reserved. 
     325# Copyright (C) 2008-2010 Foswiki Contributors. All Rights Reserved. 
    313326# Foswiki Contributors are listed in the AUTHORS file in the root 
    314327# of this distribution. NOTE: Please extend that file, not this notice. 
  • trunk/core/lib/Foswiki/Search.pm

    r6595 r6665  
    2121use Foswiki::WebFilter                (); 
    2222 
    23 #TODO: move these into a more appropriate place - they are function objects so can persist for a _long_ time 
    24 my $queryParser; 
    25 my $searchParser; 
    26  
    2723BEGIN { 
    2824 
     
    6460    my $this = shift; 
    6561    undef $this->{session}; 
     62 
     63# these may well be function objects, but if (a setting changes, it needs to be picked up again. 
     64    if ( defined($this->{queryParser}) ) { 
     65        $this->{queryParser}->finish(); 
     66        undef $this->{queryParser}; 
     67    } 
     68    if ( defined($this->{searchParser}) ) { 
     69        $this->{searchParser}->finish(); 
     70        undef $this->{searchParser}; 
     71    } 
    6672} 
    6773 
     
    355361    my $theParser; 
    356362    if ( $params{type} eq 'query' ) { 
    357         unless ( defined($queryParser) ) { 
     363        unless ( defined($this->{queryParser}) ) { 
    358364            require Foswiki::Query::Parser; 
    359             $queryParser = new Foswiki::Query::Parser(); 
    360         } 
    361         $theParser = $queryParser; 
     365            $this->{queryParser} = new Foswiki::Query::Parser(); 
     366        } 
     367        $theParser = $this->{queryParser}; 
    362368    } 
    363369    else { 
    364         unless ( defined($searchParser) ) { 
     370        unless ( defined($this->{searchParser}) ) { 
    365371            require Foswiki::Search::Parser; 
    366             $searchParser = new Foswiki::Search::Parser($session); 
    367         } 
    368         $theParser = $searchParser; 
     372            $this->{searchParser} = new Foswiki::Search::Parser($session); 
     373        } 
     374        $theParser = $this->{searchParser}; 
    369375    } 
    370376    try { 
     
    710716 
    711717            #TODO: i wonder if this shoudl be a HoistRE.. 
     718            #TODO: well, um, and how does this work for query search? 
    712719            my @tokens  = @{ $query->{tokens} }; 
    713720            my $pattern = $tokens[$#tokens];       # last token in an AND search 
  • trunk/core/lib/Foswiki/Search/Parser.pm

    r6582 r6665  
    4848    # Build pattern of stop words 
    4949    my $prefs = $this->{session}->{prefs}; 
     50    ASSERT($prefs) if DEBUG; 
    5051    $this->{stopwords} = $prefs->getPreference('SEARCHSTOPWORDS') || ''; 
    5152    $this->{stopwords} =~ s/[\s\,]+/\|/go; 
     
    5354 
    5455    $this->{initialised} = 1; 
     56} 
     57 
     58=begin TML 
     59 
     60---++ ObjectMethod finish() 
     61Break circular references. 
     62 
     63=cut 
     64 
     65sub finish { 
     66    my $self = shift; 
     67 
     68    undef $self->{stopwords}; 
     69    undef $self->{initialised}; 
    5570} 
    5671 
Note: See TracChangeset for help on using the changeset viewer.