I’ve been using the following boolean search term to narrow down some documents: OR (violen* NEAR religio*). The idea is to find derivatives of “violence” near derivatives of “religion” in addition to other search terms. Running the NEAR search by itself works as expected. Adding the OR + parenthetical expression above returns hits with “violence” nowhere near, or completely independent of, “religion.” In fact, it’s as if the NEAR expression carries no meaning and the search becomes violen* OR religio*.
Pardon if the following is not sensical, but the information provided is limited and IMO it’s not clear what your search predicate is.
If it is
OR (violen* NEAR religio*)
DEVONthink will not parse it correctly because OR is disjunctive but not distributive. OR occurs between two terms.
OK, that’s helpful. You have the correct idea of the search, but just to be sure, let’s say my search is the following:
terrorism OR (violen* NEAR religio*)
Assume I have records with the following sample phrases:
- “terrorism is illegal”
- “one day I saw some violent guys and after closer inspection I determined they were also religious”
- “Man, that hockey game was really violent [1,000 words] I go to church because I’m religious.”
I want a Boolean search that returns 1 & 2 but not 3. I assumed that the search would give me a hit on “terrorism” for 1 and “violen* NEAR religio*” for 2, but nothing for 3. Your response has explained the fault in the search, so the question is how (or is it even possible) to search for 1 & 2 but not 3.
PS It’s worth noting that OR seems to work when followed by a quoted phrase, so is it just the parentheses that are the problem?
I’m still stuck on this. I was able to successfully execute a search for
A OR (B AND C)
A OR (B NEAR C)
What’s the difference here? OR is distributive in the first example, no? It shouldn’t be because AND is higher priority because I’ve used parentheses, which is supposed to force that part of the search first, right?
(It’s worth pointing out that my Boolean logic isn’t necessarily up to speed. )
I’m not sure from this what “success” is, so I couldn’t answer directly what the failure is.
Perhaps this guidance from Help is useful in sorting the problem:
This indicates the terms in the parentheses are evaluated, and then ORd with the first term. (Thus, OR is not distributive; A is disjunctive with the results of (B C).) The default for “NEAR” is “within 10 words”, you can modify the scope by using “NEAR/n” where “n” is the number of words that define the neighborhood. On the other hand, “AND” is any presence of both terms in the document, regardless of the number of words between. So, we could infer that your first example might return more results than the second.