Counting of specific phrase

While I suspect that when searching for a specific word phrase, the column “score” is based on the frequency of the appearance of such phrase in each document, is it possible to show the frequency count of the appearance as well (as an option)? Another possibility is to allow users to set up their list of phrases (instead of the default of a single word) and see a summary stat similar to the Concordance report.

I understand this is not a feature that everyone needs. But this is a very handy tool for researchers/students who need to perform basic content analysis/discourse analysis which usually need to (1) run a basic search stat on a certain phrase (2) can run stat on a group of several words/phrase because they represent similar meaning. Specialised apps such as NVivo can perform very sophisticated content analysis but it is extremely slow and inefficient even for basic operations. I think the engine of DT is extremely efficient and can perform some core functions of content analysis a lot better.

Thanks for the suggestion! While there are currently no such plans, AppleScript might be a workaround. Here’s a simple script: Just select some items, execute the script and enter the string to search. The script opens a window with the number of occurrences in each document.

use framework "Foundation"

tell application id "DNtp"
		set theSelection to the selection
		if theSelection is {} then error "No documents selected."
		set theQuery to display name editor "\"Web\" Search" info "Query:"
		set theTab to open tab for URL "about:blank"
		do JavaScript "; document.write('<html><title>" & theQuery & "<\\/title><body><table cellpadding=4><tr><th><small>#<\\/small><\\/th><th align=left><small>Item<\\/small><\\/th><\\/tr>');" in theTab
		repeat with theRecord in theSelection
			set theText to plain text of theRecord
			if theText is not "" then
				set theText to stringWithString_(theText) of NSString of current application
				set theText to lowercaseString() of theText
				set theText to theText as string
				set od to AppleScript's text item delimiters
				set AppleScript's text item delimiters to theQuery
				set theQueryCount to (count theText's text items) - 1
				set AppleScript's text item delimiters to od
				set theQueryCount to 0
			end if
			set theName to name of theRecord
			set theLink to "x-devonthink-item://" & uuid of theRecord
			set theCode to "<tr><th><small>" & (theQueryCount as string) & "<\\/small><\\/th><td><small><a href=\"" & theLink & "\">" & theName & "<\\/a><\\/small><\\/td><\\/tr>"
			do JavaScript "document.write('" & theCode & "');" in theTab
		end repeat
		do JavaScript "document.write('<\\/table><\\/body><\\/html>'); document.close();" in theTab
	on error error_message number error_number
		-- if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell