Re: Search for several words with OR operator

Petko Yotov <[email protected]>
Newsgroups gmane.comp.web.wiki.pmwiki.user
Message-ID <[email protected]>
On 29/06/2023 10:02, Gregor Klarič wrote:
> I am trying to find all pages which contain word1 OR word2 OR word3
> 
> Is this possible?

Not exactly out of the box, but in a custom function you can do this:

   $list = [];

   $opt = [''=>['word1'] ];
   FPLTemplatePageList($pagename, $list, $opt);

   $opt = [''=>['word2'] ];
   FPLTemplatePageList($pagename, $list, $opt);

   $opt = [''=>['word3'] ];
   FPLTemplatePageList($pagename, $list, $opt);

   # now $list has all pages that contain word1 OR word2 OR word3


Out of the box something similar can be achieved with categories:

   https://www.pmwiki.org/wiki/PmWiki/Categories

Pages can belong to multiple categories and can be shown with Pagelists 
in very flexible ways, for example:

   !! All pages from Cat1 OR Cat2 (at least one)
   (:pagelist category=Cat1,Cat2:)

   !! All pages from Cat1 AND Cat2 (both)
   (:pagelist category=+Cat1,+Cat2:)

See https://www.pmwiki.org/wiki/PmWiki/PageLists#wildcards

And you can format the list with a custom pagelist template if you want.

Petko

_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.