internal package Foswiki::Search::InfoCache

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

internal package Foswiki::Search::InfoCache is a Foswiki::ListIterator

Support package; cache of topic info. When information about search hits is compiled for output, this cache is used to avoid recovering the same info about the same topic more than once.

TODO: this is going to transform from an ugly duckling into the ResultSet Iterator

I have the feeling that we should make result sets immutable

ClassMethod new($session, $defaultWeb, \@topicList)

initialise a new list of topics, allowing their data to be lazy loaded if and when needed.

$defaultWeb is used to qualify topics that do not have a web specifier - should expect it to be the same as BASEWEB in most cases.

because this 'Iterator can be created and filled dynamically, once the Iterator hasNext() and next() methods are called, it is immutable.

TODO: duplicates??, what about topicExists? TODO: remove the iterator code from this container and make a $this->getIterator() which can then be used. TODO: replace the Iterator->reset() function with a lightweight Iterator->copyConstructor? TODO: or..... make reset() make the object muttable again, so we can change the elements in the list, but re-use the meta cache?? CONSIDER: convert the internals to a hash[tomAddress] = {matches->[list of resultint text bits], othermeta...} - except this does not give us order :/

ObjectMethod sortResults($params)

the implementation of %SORT{"" limit="" order="" reverse="" date=""}%

it should be possible for the search engine to pre-sort, making this a nop, or to delay evaluated, partially evaluated, or even delegated to the DB/SQL

can call repeatedly, the list will only be re-sorted if new elements are added.

filterByDate( $date )

Filter the list by date interval; see TimeSpecifications.

$infoCache->filterByDate( $date );

Topic revision: r1 - 19 Apr 2011, ProjectContributor
 
This site is powered by FoswikiCopyright © CC-BY-SA by the contributing authors. All material on this collaboration platform is copyrighted under CC-BY-SA by the contributing authors unless otherwise noted.
Ideas, requests, problems regarding Foswiki? Send feedback