cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean searches with NOT

hbf
Champ on-the-rise
Champ on-the-rise
Hi,

I've read through the Search documentation and see that "NOT" is not supported in some cases:

Note that queries with a single "NOT" entry or single TERM query precided with "-" are not supported.

Unfortunately, this exception seems to apply also to subqueries.

Here are a few examples illustrating this; I used category searches so you can perform the queries in your Alfresco installation by tagging a few nodes with some of the Regions tags "Switzerland", "France", or "Liechtenstein".

"Switzerland AND France" (works):
 PATH:"/cm:generalclassifiable//cm:Switzerland//member" AND PATH:"/cm:generalclassifiable//cm:France//member"

"Switzerland AND NOT France" (works):
 PATH:"/cm:generalclassifiable//cm:Switzerland//member" AND NOT PATH:"/cm:generalclassifiable//cm:France//member"

"Switzerland AND (Liechtenstein OR NOT France) (does not work😞
 PATH:"/cm:generalclassifiable//cm:Switzerland//member" AND ( PATH:"/cm:generalclassifiable//cm:Liechtenstein//member" OR NOT PATH:"/cm:generalclassifiable//cm:France//member")

It seems that OR makes the left and right operands individual clauses so that the exception applies. Is this so?

Funnily, if I put the last query from above into Disjunctive Normal Form and oops, the thing works:

"Switzerland AND (Liechtenstein OR NOT France) (works😞
 ( PATH:"/cm:generalclassifiable//cm:Switzerland//member" AND PATH:"/cm:generalclassifiable//cm:Liechtenstein//member") OR ( PATH:"/cm:generalclassifiable//cm:Switzerland//member" AND NOT PATH:"/cm:generalclassifiable//cm:France//member")

So:

1. Is what I observe a bug or is it a consequence of the aforementioned exception rule?

2. How can I make Boolean queries work? Do I have to convert to DNF?

3. Is this an Alfresco or Lucene issue?

4. Will Alfresco (Lucene?) support Boolean queries in the future?

Thanks,
Kaspar
1 REPLY 1

lukask
Champ in-the-making
Champ in-the-making

I have the same issue with Alfresco 5.2 Enterprise Edition.

1. Is what I observe a bug or is it a consequence of the aforementioned exception rule?

2. How can I make Boolean queries work? Do I have to convert to DNF?

3. Is this an Alfresco or Lucene issue?

4. Will Alfresco (Lucene?) support Boolean queries in the future?

Can someone answer the questions?