From: Peter T. <pe...@th...> - 2000-05-05 07:21:24
|
Kevin, this is great stuff! May I suggest to use the TWiki.Codev web so that it is documented for developers at the right place. Once it is in the Beta we can document it for users by modifying the Main.TWikiVariables topic. Regards, Peter Kevin Kinnell wrote: > > I now have working, tested code that extends the > %SEARCH{...} tag a little... > > The syntax is > %SEARCH{ <searchstr> web=<webstr> scope=<scopestr> > order=<ordstr> limit=<digitstr> > casesensitive=<flag> regex=<flag> reverse=<flag> > nosummary=<flag> nosearch=<flag> nototal=<flag> } > > (In use this all goes on one line, of course...) > > searchstr is the string to search for. > > webstr is a (possibly empty) list of words separated by > spaces, or the single word 'all'. In the case of > a list, each word checked to see if it is the name > of a web. if the web exists, the search results > for that web are listed together with a headline of > that web's color and it's name centered in the line. > Non-web words are silently skipped. The word 'all' > has no special meaning unless it is the only word in > the list (so you can have a web named 'All' and search > only it by making a list like "foo All".) Any web > which sets NOSEARCHALL=on in it's WebPreferences topic > will not be listed in an 'all' search; an 'all' search > makes a list of the directories under $dataDir and > uses that list for the webs to search. Only when > targeted by an 'all' search will a web that has a > NOSEARCHALL *not* be included in the searches -- if the > web's name is directly included in the webstr the > NOSEARCHALL preference has no effect. (whew.) > > ordstr is one of 'date', 'editby' and anything else means 'topic' > It controls the sort order of the search results. I bet > you guess. This darned attribute is what started all of > these silly mods! > > digitstr is a string consisting solely of digits, used to > limit the number of 'hits' to a search on a per web > basis. If a web has fewer hits than the limit, only the > those hits are listed (i.e., it's not an error to specify > too many.) > > flag is either "" (off) or anything else (on); undef can't > happen. > The new flag is 'reverse'; if true the order of the > results > is inverted. > > all of the other options are as they were in 01May. > > In addition, I have a working modified 'search' script that simply takes > *all* of the search options made available by a form. Previously, > several > options were hard-coded. > > The code in the modified wikisearch.pm uses a revision date -> epoch > seconds > conversion function now; previously sorting was done on the basis of > stat > calls, but if the sysadmin has to 'touch' the topic files for any reason > they > sort improperly. The rev to secs sub doesn't actually get the seconds > from the > revision date, so two topics that were revved within sixty seconds of > one another > may sort improperly. I don't feel this is a big hardship... ;-) > > The limit attribute interacts with the list of results *last*. This > means that > if you ask for a regex-searched date-sorted sort-reversed (ie, latest > first) > search that is limited to five hits, you get the five hits after all the > sorting > and reversing and searching are done. > > Multi-web searches share options, you can't spec more than one set of > opts per > %SEARCH{...}% That would be ridiculous, anyway. > > Bugs: 1) you can't turn off the color-coded overbar on any search. Yet. > 2) it's still based on the 0404beta code. I have the 01May code, > but > I haven't got the time yet. (besides, I'm waiting for CVS. > Well, > Nicholas? :-) > > -- > Kevin Kinnell <ke...@ne...> > perl -e 'print unpack("u",q,9`#`@(&430$%:1C4W<APD/"-T!BHD(2(F00``, > )^($_=(join" ",reverse(qw/HACK ANOTHER PERL JESTER..../) > )[0],s/ //g)[0];' > > _______________________________________________ > TWiki-Dev mailing list > TWi...@li... > http://lists.sourceforge.net/mailman/listinfo/twiki-dev -- ||| Peter Thoeny mailto:Peter@Thoeny.com (o o) 7203 Via Vico +---oOO--( )--OOo---+ San Jose, CA 95129, USA | If it is to be | Phone: +1-408-255-1477 (UTC -8h) | It is up to me | http://www.thoeny.com/peter/ +==oOO====v====OOo==+ |