Including Wikilinks in Incoming/Outgoing Item Links column

Incoming and outgoing [[wikilinks]] are reflected in the “Links” tab of the Document inspector panel alongside [devonthink](x-devonthink-item://item-links), but unlike those, incoming and outgoing wikilinks aren’t counted in the corresponding columns in my database, or for purposes of smart groups. Is this a setting or expected behavior? For folks who use wikilinks heavily, as I do, this would be fantastic functionality.

Wiki links are not indexed but only calculated on the fly whenever necessary. That’s e.g. no problem when viewing/editing documents or using the Document > Links inspector but would not be useful for such a column or even smart groups and therefore is currently not possible.

The advantage of the current approach is that it doesn’t waste disk space & CPU time and everything’s immediately up-to-date after changing settings or renaming/editing/creating/deleting items etc.

Anyway, which Wiki link style do you use? Square brackets? In this simple case a small script & a smart rule could automatically calculate the values after importing/editing documents. This doesn’t cover all shortcomings but depending on your usage scenario this might be sufficient if links are usually just added by importing/editing documents.

Here’s a basic example:

on run
	tell application id "DNtp" to my performSmartRule(selected records)
end run

on performSmartRule(theRecords)
	tell application id "DNtp"
		repeat with theRecord in theRecords
			-- 1. Update number of incoming/outgoing Wiki links of created/imported/edited document first
			set outgoingLinks to outgoing Wiki references of theRecord
			set numOutgoingLinks to count of outgoingLinks
			add custom meta data numOutgoingLinks for "outgoingwikilinks" to theRecord
			set numIncomingLinks to count of incoming Wiki references of theRecord
			add custom meta data numIncomingLinks for "incomingwikilinks" to theRecord
			-- 2. Update number of incoming Wiki links of referenced documents
			repeat with theLink in outgoingLinks
				set numIncomingLinks to count of incoming Wiki references of theLink
				add custom meta data numIncomingLinks for "incomingwikilinks" to theLink
			end repeat
		end repeat
	end tell
end performSmartRule

And the smart rule could look like this:

Clever-- thank you!