I’m attempting to use the new AI search. My use case is to find any document whose name starts with SOW followed by a number (from 0-999). Examples would be
SOW123 for Acme Corp
SOW1054 for United Boxes
etc.
The prompt I wrote was:
Find files with a name that starts with SOW followed immediately by a 1-4 digit number. For example, “SOW123 for Acme Corp” or “SOW1054 for United Boxes”
The search query I got was:
name:<SOW[0-9][0-9][0-9][0-9]*>
This doesn’t yield any results and I think the angle brackets are spurious. If I remove them, I get documents with exactly four digits, but not fewer digits. How can DEVONthink search for any number from 1-999? Could the AI knowledgebase be tweaked to give only searches that fit the DEVONthink syntax?
By default I would recommend an inexpensive, fast model (like Gemini Flash) that is used by the built-in commands (e.g. summaries or tagging) and on demand, if necessary, a different model in the chat assistant (or in smart rules & batch processing and scripts).
Actually it’s not exactly possible, one of the reasons the AI fails. The “Name begins…” with condition doesn’t support wildcards. And a search like name:SOW[0-9]* would find occurrences not only at the beginning.
Models like GPT-4o or Claude 3.7 Sonnet. But as models use their own knowledge too, the result is not always a valid one. Just like all AI results.
The name:SOW[0-9]* format works well for my use-case. Ah - I’d come to the same conclusion with DT3; that it doesn’t actually support wildcards in “begin with”. Good to know.
One thing… Most models I’ve tried (including Gemini) add this < character, which I think is invalid search syntax. Is that some kind of bug; maybe it’s picking it up somehow from docs/knowledgebase? Could the AI search functionality run the result through a programatic check to catch any errors, for example?
It’s not a bug. It’s the AI trying to guess what the syntax should be and the models will often spit out different possibilities. As there is some flexibility in the syntax, the result may still work or it can be a starting point.
Okay - I think perhaps the issue is that this particular search doesn’t seem to work with the ? wildcard. So this will work:
name: sow[0-9]*
But this won’t
name: sow[0-9]?
(this can be replicated by trying to type this into the main search box)
Is it possible to put in a feature request for all the conditions working the same? E.g. for the name: operator to support the ? wildcard, and for “Name begins with” to support any wildcard. Or if not, for there to be really clear documentation that can be passed to the AI to help it build the correct search queries.
Only the matches conditions support operators & wildcards as they use the search index, everything else (begins with, ends with, contains etc.) is a simple string comparison and doesn’t support wildcards.
We’ll try to improve the search assistant but AI responses using common models will never be 100% reliable (although top models usually work quite well).
If you want exact numbers of digits, use the matches criteria (:) with a query utilizing character wildcards—specifying the digits range, [0-9]—and the boolean operator OR. Like so:
prefix:[0-9] OR [0-9][0-9] OR [0-9][0-9][0-9] OR [0-9][0-9][0-9][0-9]
Both are valid but do not return the same results. The first one returns names containing sow, followed by a digit and optionally one or more characters. The second returns names containing sow, followed by a digit and exactly one more character.
After some changes at least O3 (Mini) and Claude 3.7 Sonnet sometimes return a valid syntax:
(name:SOW[0-9] OR name:SOW[0-9][0-9] OR name:SOW[0-9][0-9][0-9] OR name:SOW[0-9][0-9][0-9][0-9])
name:SOW[0-9]*
The first one is exactly what you were looking for but obviously rather complicated. But the next beta will also accept invalid queries like name:<SOW[0-9][0-9][0-9][0-9]* and automatically change the condition to matches.