Hi everyone,

we currently have some issues when performing refactoring operations on pages that are linked from another wiki page. See: https://jira.xwiki.org/browse/XWIKI-8346

The current implementation of the links is to keep the local name of the current document and to create a reference containing the name of the wiki for the target document, only if it's a document from another wiki. So basically if I have a wiki:A pointing to subwiki:B, I will get a link stored in DB of "wiki", containing:
  - fullName: A
  - link: subwiki:B

This forces us to currently iterate over all wikis, when we refactor a page to edit all the links on the farm. That's why we currently have an option which is disabled by default: i.e. we don't update backlinks on a farm by default.

In order to allow such operation with less performance issues, I propose to add a new table dedicated to store the backlinks: basically this table would store the reversed information as Links, in the target DB.

If I take back my example, the table backlinks of "wiki" would be empty, and I get in the table backlinks of "subwiki", the following information:
  - fullName: B
  - backlink: wiki:A

Then we could load all backlinks of a document just by looking in one table. The impact on performance would be the necessity to update links in two tables when performing a save, but we can mitigate this by first loading the links so we only update what needs to be (currently we delete and recreate all links, each time...).

IMO it would really ease the understanding of links and backlinks, solve the issues on farm and help us to maintain this code. + it doesn't break any legacy since we keep the existing Link table.

WDYT?

Simon
--
Simon Urli
Software Engineer at XWiki SAS
[email protected]
More about us at http://www.xwiki.com

Reply via email to