[pmwiki-users] RFC: Indexing categories and links

Petko Yotov 5ko at 5ko.fr
Wed Mar 3 13:58:36 CST 2010


Hello.

Many times, there have been requests about improving the way Pagelists with 
Backlinks are generated, particularly about the category feature. 

  (:pagelist link=Category.Name:)

There are two different markups, [[Category/Name]] and [[!Name]] which both 
create a link to the page Category.Name, and pages both are currently 
displayed in the above pagelist.

Authors have asked for the possibility to list only pages containing the 
category link [[!Name]] but not containing the regular link [[Category/Name]].

Category links are stored in a special attribute in the page file, and also in 
a special file .pageindex to speed up the searches, in the form "Category.Name 
Category.Name2" etc.

We have come up with an idea to add both strings "Category.Name" and "!Name" 
to the page attribute and to the .pageindex file. 

* If a page contains a link [[!Name]], both "Category.Name" and "!Name" are
  stored in the indexes.

* If a page contains a link [[Category/Name]], only "Category.Name" is
  stored in the indexes.

* A pagelist with link=Category.Name will find all pages linking to
  Category.Name, both [[Category/Name]] and [[!Name]], like now. 
  No wikis will break because of the change.

* A pagelist with link=!Name will find only pages containing [[!Name]], which
  is new. Only newly created (:pagelist link=!Name:) will display these pages.

This way, with a few changes of 3 or 4 core functions, it is possible to add 
the much requested feature, and to stay backwards compatible with all current 
installations. (WikiAdmins may need to remove the wiki.d/.pageindex file after 
upgrading to let PmWiki reindex the site.)

So my first question is should we do this change?


Another feature was suggested by Peter Bowers. We can have globally defined 
link prefixes like :

  ! for Category
  ~ for Profiles

and others. These link prefixes can be defined in config.php and then used in 
the wiki, like for example
  [[:Name]] = [[Projects/Name]] or
  [[@Name]] = [[Tags/Name]] or
  [[+Name]] = [[ToDo/Name]] etc.

If we change the current !Category and ~Profiles links to be handled by the 
same mechanism as [[regular links]], adding more prefixes will be very easy 
for wiki admins. PmWiki will likely not have new link prefixes, but individual 
wikis could add them with such line in config.php:

  $LinkPrefixGroup['@'] = 'Tags';

Using a global way of dealing with links will fix some bugs we've had for a 
long time:

  "[[!My category | Alternative text ]]" doesn't work in 2.2.14
  "[[!My category |+]]" doesn't work in 2.2.14
  "[[!My category]]suffix"  doesn't work in 2.2.14

So my second question is should we enable this link-prefix feature?

If your answer is yes, I'll invite you to download the latest "pre-release" 
code from Subversion, test the new features and report any problems which we 
haven't discovered yet. 
  http://www.pmwiki.org/wiki/PmWiki/Subversion

Note, these changes in Subversion are for testing and discussing purposes, so 
don't build upon them. We (especially Pm) may conclude that we shouldn't 
release them at this moment.

Thanks,
Petko

P.S. The current proposition will not yet allow a pagelist with  
link=Page1,Page2 or link=Page1,-Page2 to list pages to 2 or more categories -- 
which would require more substantial changes to the Pagelist functions which 
should be done more carfully, not today.



More information about the pmwiki-users mailing list