cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] Empty or null description in Lucene query

nenad982
Champ on-the-rise
Champ on-the-rise
Hi all,

I want to write Lucene query that will return all content which has empty or null cm:description property. Is it possible to do that?

Thanks…
5 REPLIES 5

kaynezhang
World-Class Innovator
World-Class Innovator
You can try to use queries like ISNULL:"{http://www.alfresco.org/model/content/1.0}name" or ISNULL:"cm:name"

Thanks kaynezhang, this will work for me.

chetan
Champ in-the-making
Champ in-the-making
Hi Kaynezhang,

Can we use above mentioned query (ISNULL:"{http://www.alfresco.org/model/content/1.0}name" or ISNULL:"cm:name") to write a query using 'org.apache.lucene.search.Query' class. It would be a great help if you can explain with a example code snippet.

Thanks,
Chetan

nenad982
Champ on-the-rise
Champ on-the-rise
Hi all,

one update it does not work for empty property values just for NULL property values. Is there any way to find empty properties?

Thanks

kaynezhang
World-Class Innovator
World-Class Innovator
Lucene/Solr does not support searching for empty values,so if you want search some field with null value ,you can define a default value(for example "none") in your model.then you can search for the default value.

If you really want to search empty field ,you can try following code

*:* AND -@cm\:name:

  • It is not a good way ,it has low performance.