Lucene boolean search is broken?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2009 05:38 AM
Hello
I have been struggling with following issue. I have a type with a boolean property:
Now, when I search with Lucene using a query:
I get also results which have plcy:commission_accounted set to 'false', I have also tried other queries like:
etc. and I _always_ get wrong results, for example (node's id, value and the class name of the value):
Funny thing is that when I search for objects with commission_accounted=false I always get correct results. Any ideas what I am doing wrong?
Thanks
Karol
I have been struggling with following issue. I have a type with a boolean property:
<type name="plcy:commission"> <title>Commission</title> <parent>cm:content</parent> <properties> <property name="plcy:commission_accounted"> <title>Accounted</title> <type>d:boolean</type> <default>false</default> </property> … …
Now, when I search with Lucene using a query:
+TYPE:"plcy:commission" AND +@plcy\:commission_accounted:"true"
I get also results which have plcy:commission_accounted set to 'false', I have also tried other queries like:
+TYPE:"plcy:commission" +@plcy\:commission_accounted:"true"+TYPE:"plcy:commission" +@plcy\:commission_accounted:true+TYPE:"plcy:commission" AND +(@plcy\:commission_accounted:true)+@plcy\:commission_accounted:true
etc. and I _always_ get wrong results, for example (node's id, value and the class name of the value):
2e5f8362-6696-4def-9534-9821a49806c2 true class java.lang.Boolean17dc9fdf-0f92-4444-82f1-944d2a91e17e true class java.lang.Boolean64bbb631-79aa-4ae9-944e-d5d0c63be064 false class java.lang.Boolean84ce8e4c-3317-4fc6-a3c8-902f5a5388b3 false class java.lang.Boolean92b6949e-0db5-4d0a-8972-c90ab248101c false class java.lang.Boolean6d241b53-5e47-4cb0-a50b-1b9783d3ba19 false class java.lang.Boolean
Funny thing is that when I search for objects with commission_accounted=false I always get correct results. Any ideas what I am doing wrong?
Thanks
Karol
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2009 02:29 PM
Having TYPE criteria in you search seem superfluous since your property is only available to that specific type.
Also, AND and the + means the same thing (so in some of your samples queries you have doubled them), see http://wiki.alfresco.com/wiki/Search#Combined_Queries
Maybe using - (must nor match) if only false query works. Then you maybe need to search for TYPE as well, contrary to what I said int the beginning.
Also, AND and the + means the same thing (so in some of your samples queries you have doubled them), see http://wiki.alfresco.com/wiki/Search#Combined_Queries
Maybe using - (must nor match) if only false query works. Then you maybe need to search for TYPE as well, contrary to what I said int the beginning.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2009 06:02 AM
Having TYPE criteria in you search seem superfluous since your property is only available to that specific type.
Also, AND and the + means the same thing (so in some of your samples queries you have doubled them), see http://wiki.alfresco.com/wiki/Search#Combined_Queries
Maybe using - (must nor match) if only false query works. Then you maybe need to search for TYPE as well, contrary to what I said int the beginning.
You are right about TYPE criteria, however it shouldn't change the result…
Here is a summary of my queries:
Search: @plcy\:commission_accounted:true
Results 24 rows
(some of those 24 rows contained records with 'false' commission_accounted)
Search: @plcy\:commission_accounted:false
Results 686 rows
Search: not @plcy\:commission_accounted:false
Results 686 rows
Search: -@plcy\:commission_accounted:false
Results 0 rows
Search: +TYPE:"plcy:commission" AND -@plcy\:commission_accounted:false
Results 24 rows
So the question is still the same: how is it possible? And how to query for records with commission_accounted=true?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2009 09:46 AM
Only thing I can think of to try is
+TYPE:"plcy:commission" AND -@plcy\:commission_accounted:true
That should give you all the false ones.
But I agree, this should be doable with only @plcy\:commission_accounted:false, maybe someone else can step in here that has experience of boolean searches.
+TYPE:"plcy:commission" AND -@plcy\:commission_accounted:true
That should give you all the false ones.
But I agree, this should be doable with only @plcy\:commission_accounted:false, maybe someone else can step in here that has experience of boolean searches.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2009 01:08 PM
Unfortunately it doesn't work…
Search: +TYPE:"plcy:commission" AND -@plcy\:commission_accounted:true
Results 0 rows
I will try to report proper bug report about it and in the meantime I will try to change that attribute from boolean to an integer…
Thanks for suggestions!
Karol
Search: +TYPE:"plcy:commission" AND -@plcy\:commission_accounted:true
Results 0 rows
I will try to report proper bug report about it and in the meantime I will try to change that attribute from boolean to an integer…
Thanks for suggestions!
Karol
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2009 06:37 AM
I was working yesterday on very similar query which works correctly.
+TYPE:"rma:dispositionAction" +@rma\:dispositionEventsEligible:true
+TYPE:"rma:dispositionAction" +@rma\:dispositionEventsEligible:false
I've just run it on HEAD and it works, both for the true case and the false case.
+TYPE:"rma:dispositionAction" +@rma\:dispositionEventsEligible:true
+TYPE:"rma:dispositionAction" +@rma\:dispositionEventsEligible:false
I've just run it on HEAD and it works, both for the true case and the false case.
