0

I have Alfresco 5.2 and my task is "to get all documents with empty (one of) property", I am creating a query

 searchParameters.setQuery("search +TYPE:\"ecmcndintregst:nd_int_reg_standards\" +@ecmcnddoc\\:doc_name_ru:\"\" -ASPECT:\"ecmcdict:inactive\" AND ( @ecmcnddoc\\:doc_kind_cp_ecmcdict_value:\"mek\")");
    

And I got all the documents thus: with either - empty and non-empty ecmcnddoc:doc_name_ru how can I get ONLY empty ecmcnddoc:doc_name_ru ?

Thank you please tell me what am I doing wrong? How to search solr for empty properties? When I submit +@ecmcnddoc:doc_name_ru:"" (without slash) I got all documents with ANY ecmcnddoc:doc_name_ru value :( Thank you

  • Is the field empty, or is the field missing (i.e. are you getting an empty value back)? What is the type of the field? What happens if you _only search_ for that? (i.e. drop everything else, only include that single query). Also be aware that suddenly using `AND` in your query might not be parsed as you expect, since the previous term is a negative one - instead try to use `+` _or_ boolean syntax for all properties. – MatsLindh Jun 28 '20 at 18:10
  • The filed is empty (contains ""), the type is text, I will answer other questions a little bit later – Ekaterina Ivanova iceja.net Jun 28 '20 at 19:18
  • At least your example query is wrong since you're escaping the `"` inside your query - so start by looking at the generated query (using `debug=all`). Which query parser are you using? (`defType=...`) – MatsLindh Jun 28 '20 at 19:28
  • My search query in Java searchParameters.setQuery("search +TYPE:\"ecmcndintregst:nd_int_reg_standards\" +@ecmcnddoc\\:doc_name_ru:\"\" -ASPECT:\"ecmcdict:inactive\" AND ( @ecmcnddoc\\:doc_kind_cp_ecmcdict_value:\"mek\")"); I am using the default alfresco query parser package org.alfresco.service.cmr.search – Ekaterina Ivanova iceja.net Jun 28 '20 at 20:29
  • 1
    Then that query parser might be the issue; seeing as you're not mentioning Alfresco in your question, that's important information for anyone trying to help with queries being parsed and matched. I'm not familiar with Alfresco at all; try to get it working properly in the Solr Admin query interface first; that way you can at least be sure that your query works properly, then you move on to making it work in your Java code. – MatsLindh Jun 28 '20 at 20:54

0 Answers0