What does the Tablet set's QuickFind do?


Got asked this today (it’s undocumented). It doesn’t do an NP ‘quickfind’ search. Instead… here’s a quick summary from a walk through the HTML/JS code in Tablet source.

  • The box top right submits an HTML form ‘af2’ which is hidden code at the bottom of each template.

  • Submitting the quickfind search box calls code in client.js, function doKeywordSearchSubmit() which then calls function doTBSearch() which updates the values of form ‘af2’ and submits it.

  • The words ‘and’ or ‘or’ - in either upper or lower case are interpreted as AND or OR join instructions. The default join - if none is user-supplied is AND.

  • Joins parsed from text are parsed as with the flow of text; this is a bit hit-and-miss, you’ll need to experiment. Thus: ‘cat or dog’ – > keywords contains cat or keywords contains dog.

  • There is no support for ‘not’ as a term - i.e. it can’t be used to reverse the operator (contains/does not contain). In the latter case it’s always contains and ‘not’ is treated as a keyword.

  • If part of the input is in double quotes (not single quotes), that word or phrase is tread as a single term: “cat fight” and dog – > keywords contains cat fight or keywords contains dog.

  • Input items in double quotes are switched to use a ‘matches’ op, otherwise the match is always ‘contains’.

  • The target field is always Keywords. It is set in the calling template’s Quick find forms HTML: doKeywordSearchSubmit(event,‘Keywords’,‘headerSearchbox’).

I hope that helps those trying to customise the process. If you can code JS you should have enough info to tweak the default code. Note you can’t access libraries like client.js through the NP Wizard.Instead you need to find it in Finder/Explorer and edit it in a suitable code editor. Files are UTF-8 text with Mac or win line ending depending on the platform you are on.