Displays all of the pages in this Wiki in alphabetical order. IndexPlugin has been contributed by AlainRavet.

Parameters#

  • none

Example#

See PageIndex.

There also seems to be an

  • exclude parameter, it is used in the example pages. "INSERT IndexPlugin exclude='SandBox*'" works fine, but I cannot figure out how to use it with multiple values. I understand that multiple names have to be combined to a single regular expression. On PluginRefactoring an example is given: "exclude='(.*blogentry.*|.*comments.*|~NavMenu.*)". However, INSERT IndexPlugin exclude='SandBox*,PageIndex' does not work, nor does exclude='SandBox* | PageIndex', or exclude='SandBox*|PageIndex' or exclude='(SandBox*|PageIndex)' . Can someone clarify the regular expression syntax used? -- Gregor Hagedorn, 5.8.2005
  • include parameter. Similar to the exclude parameter above, I have notice there is also a include parameter. It seems to work by including only pages that are in the include parameter. I have only used double quotes, and a single expression. -- ShaunMcDonald 2006-01-09
The IndexPlugin uses GLOB patterns which, as far as I know, do not support multiple alternative matches. A summary of the supported syntax is here -- DF

Many thanks for the clarification. Any chance to introduce a syntax supporting the exclude of multiple pages? Perhaps similar to the one erroneously shown on PluginRefactoring? -- Gregor Hagedorn, 5.9.2005

In addition to hoping for an enhancement that allows multiple include/exclude patterns, I would also like to suppress the first letter index and the highlighted first letters at the start of a new letter. In a large glossary wiki it is desirable to provide an index by letter (one letter per page), and the current plugin makes this look terrible because it insists on the head-index even for one letter, then a heading for this one letter, then the index. Please someone refactor this plugin and add a new option to enable/disable these features.

Also note that the index generates non-html compatible code, and, looking into the code, it seems to me that it sorts the already sorted collection again! -- Gregor Hagedorn, 24.11.2005

I'll all for these changes, if someone wants to take them. In fact, I would need someone to start taking care of all the core plugins...

-- JanneJalkanen


Known Problems: In version 2.2 JSPWiki is unable to correctly sort languages other than English. Accented letters (Á, Â, Ä, ß etc.) are sorted after the letter "z". For this reason page names starting with accented letters are not shown under the expected letter. Also even in English the upper case letters are sorted before all lower case letters (e. g., "CSS" will be sorted before "Category"). -- Gregor


JSPWikiCorePlugins


Can I index only pages from a name space? --Adler, 01/05/2006

Example: following markup will generate an index of all pages starting with Zoo.Birds.

  [{IndexPlugin include='Zoo.Birds.*' }]

Nice :) The index shows Zoo.Birds.Flamengo, Zoo.Birds.Pelicano, etc... but is it possible to have something like Index for Birds Flamengo, Pelicano,...

or

Index for Birds

  • Flamengo
  • Pelicano
  • ...
--Adler

i Need This too... waht to "inlcude='Zoo.*'" but only to show the suffix "Flamenco" in F's "Pelicano" in P's ... is this possible?

Thanks for AnswerMe

-- MartinU


Re excludes with multiple values:

Without knowing why, I added an "exclude='..'" entry to an IndexPlugin that already had an exlude entry. It had the desired result - both patterns were excluded!


Follow-up on the previous statement:
I'm not able to exclude two or more pages. For example I want to exclude 'Category*' AND '*Favorites'. Does anyone know the solution? --Newbie, 07-Jul-23

Solution#

It uses regular expressions (the "OR" (vertical bar) has to be escaped).

Try this to exclude files whose name simultaneously start with "Category" and end with "Favorite":

[{INSERT IndexPlugin exclude='Category.*Favorite'}]

Try this if you mean to exclude file names starting with "Category" or ending in "Favorite":

[{INSERT IndexPlugin exclude='Category.*\|.*Favorite'}]

Try this if you mean to exclude file names starting with "Category" or starting in "Favorite":

[{INSERT IndexPlugin exclude='Category.*\|Favorite.*'}]

Wikipedia provides good documentation of regular expressions. The simplest ones are:

Regular ExpressionDescription
.Any character
*0 or more repetition of the previous specification
.*a sequence of 0 or more characters
[0-9]characters 0 thru 9
[a-z0-9BCD]characters a-z, 0-9 and BCD
^Beginning marker (not needed because "exclude" specification assumes it by default)
$End marker (not needed because "exclude" specification assumes it by default)

For example, the regular expression "^Ab.*cd\.ef$" means:

AtomDescription
^Starts with
Abthe character "Ab"
.*is followed by as many characters necessary (including none)
cduntil we also have the "cd" characters
\.and the actual "dot" character
efand the "ef" characters
$considering the above; terminating in "cd.ef"

I hope this helps cover most cases.


Does anyone know how to solve the problem of upper case words being sorted and listed before mixed and lower case words? This is in English, and is mentioned above by Gregor as an issue in v2.2. It's still an issue in v2.4.56 and I can't find any way to solve. (Forgive me if this is a really basic question, but this is my first day using JSPWiki so I'm a total newbie.)

--Rhonda, 09-Aug-2007

Rhonda,

I realize it's probably not helpful if you're not a programmer, but changing the line in the IndexPlugin's getAllPagesSortedByName() method from

  return page1.getName().compareTo( page2.getName() ); 
to
  return page1.getName().compareToIgnoreCase( page2.getName() ); 
would do the trick. This isn't anything fancy and doesn't handle internationalization any better than Java's compareTo() method does (probably should be using the java.text.Collator class for non-English String comparisons), but this is where things would be fixed.

-- MurrayAltheim, 09-Aug-2007


Murray: Thank you! Once I get access to the files, I'll make this change and test it.

--Rhonda, 10-Aug-2007


Murray: Thank you! Once I get access to the set up files (today?), I'll make this change and test it.

--Rhonda, 10-Aug-2007


Did it work for you?

I have another idea for solving that problem: I thought about adding a new parameter - i would call it "stripe". you give number in integer and it Cuts off these exact number of characters before the Index Plugin begins to sort for the shown Index.

Example: We have some categories with the prefix category: categoryCats; categoryDogs; categoryBirds ... When you Index all pages Like [{IndexPlugin include='category*' }] you will get all these animals sorted in for letter c. When you stripe the first letters off before sorting (stripe='8' f.e.) and then sort it: Birds will become listed at B, Cats as C and Dogs for D.

Maybe a Dumb Idea, but i like it - but, i really have no clou how the algorythm works - its just some sort of "Loud thinking"

--Johannes, 11-Aug-2007

Did you check out the NamespaceIndexPlugin (see NamespacePlugin) which does exactly that: remove a 'namespace' from the items to be indexed. --DF
Nice Plugin - but the doc is a bit confusing - i needed to install 2 jars for NamespacePlugin and NamespaceIndexPlugin ;) --Johannes, 11-Aug-2007


Murray: I now have access to the setup and config files, as well as the data files. I have looked through everything I can think of (and done a search on the server too), but I cannot find where to make the change you suggested. Can you please let me know the file and file path (in a standard installation) where I need to make this change.

Thanks very much.

--Rhonda, 14-Aug-2007


Rhonda, the IndexPlugin is part of the standard distribution of JSPWiki, found in src/com/ecyrd/jspwiki/plugin/IndexPlugin.java. In that file you'll find a method called getAllPagesSortedByName(), and near the bottom of that method the line I described above. Once you've made the change you'll need to recompile the code, then reinstall the resulting JSPWiki.jar file, then restart tomcat. hope that answers your question. -- MurrayAltheim, 14-Aug-2007


Sorting is clearly buggy; please file it?

--JanneJalkanen, 14-Aug-2007


If I want do Referring page index, how can I do? For example, Some pages a referred the 'Target' page. I want to index the pages. How can I should do?

--AnonymousCoward, 09-十二月-2008 11:07


In the actual version of JSPWiki, it seems, the patterns are regular expressions. A single '*' does not work anymore. You need to use '.*' instead.

eg: 'SandBox.*' instead of 'SandBox*'

Bugs (will report them in JIRA, too):

  • itemsPerLine is ignored
  • Lists not only pages, but also attachements

--Stefan Bohn, 2008-12-17
August 27,2009 Issue with IndexPlugin after upgrading from 2.4.102 to 2.8.2

Under 2.4.102, the IndexPlugin works fine. However, when I installed 2.8.2 (to a different webapp location but using the same page store) the IndexPlugin fails to initialize and I get the following stack trace in my jspwiki.log file:

--Maarten
Very odd, but when I removed the 2.4.102 install, the IndexPlugin started working under 2.8.2. --Maarten


v2.8.4

Contrary to MurrayAltheim's info, escaping a dot (\.) is not recognized as literal dot character (at least not at the beginning of an include).

Example: include='\..*' ... shows all pages

Solution: include='\\..*' .... shows only the pages the name of which start with a dot

--Geri, 2011-10-06, 19:40 CEST

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-60) was last changed on 06-Oct-2011 20:41 by 91.118.74.226