AppleScript failing to Lookup Records with URL?

I have a big database with several groups with (unique) HTML documents. I am trying to lookup records by URL for these documents but – bizarrely – this does not work with some groups while it does work with others.

If a (selected) document has a URL attached to it, I would expect the following script to return a result:

tell application id "DNtp"
	set myItems to (get the selection)
	set myItem to item 1 of myItems
	set myURL to URL of myItem
	set myResults to (lookup records with URL myURL in database "Database")
end tell

I have been using the lookup function for a long time, and it has always worked. Now, it is not working on the same documents in some groups…
I have tried: moving the documents in another group; reloading the documents; reloading the documents from a new source; rebuilding the database… Nothing seems to get DevonTHINK to recognise the URL as an existing URL in the database.

Befuddled?

What does the info show for the URL of a problematic file?

As I would expect: the name, aliases, URL for the file… I can see the information - it’s there… but DNtp does not :open_mouth:

Please post an example URL. Thanks.

Here you are:

It’s likely due to the ? in the URL.

Do you have other documents with ? in the URL you can find?

I was thinking the same. But this one works OK:

https://alblasserwaard-genealogie.nl/getperson.php?personID=I51565&tree=tree1

What makes it extra strange is: If I create another file from the non-working URL, DNtp correctly identifies it as a duplicate… but when I lookup records with that URL, I get 0 results. :smiley:

What’s stranger is I’m seeing no issue in the 3.7.2 public build.


:stuck_out_tongue:

1 Like

The only difference I see between your two scripts is that one uses “Database” and the other one “current database”. So maybe the record in question is not in “Database”?

I tried several different options to get DNtp to ‘see’ the records… but to no avail. I ended up restoring from the internal backup; I lost several thousand documents, yes, but saved the other 150,000.
I presume that for some reason the index files were broken without DNtp realising there was a problem; even when verifying, it said the Index was OK.

And the search is working as expected now?