Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-21037

Empty labels not showing up in facet buckets

    Details

    • Bug Priority:
      Category 3
    • ACT Numbers:

      00998798

    • Premier Customer:
      Yes
    • Story Points:
      8

      Description

      Description

      In a facet search, if the label is an empty string ("") the label object doesn't show up in the bucket.

      Example with the label object missing in the first bucket (it shows up on the second bucket):

      {
        "facetsFields": [
          {
            "label": "cm:description",
            "buckets": [
              {
                "filterQuery": "cm:description:\"\"",
                "count": 1
              },
              {
                "label": "test",
                "filterQuery": "cm:description:\"test\"",
                "count": 1
              }
            ]
          }
        ]
      }
      

      Steps to reproduce

      1. Create FILE1.txt and FILE2.txt in the repo. (Just FILE1.txt is enough to reproduce the issue but the idea is to show a working scenario with FILE2.txt to spot the differences easily).  

      2. Add aspect cm:titled to FILE1.txt with property cm:description as an empty string (use the corresponding noderef): 

       

      curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -u admin:alfresco -d '{
        "aspectNames": [ "cm:titled" ],
        "properties":
         {
            "cm:description":""
          }
        }' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/52ac036e-0780-4886-8ae8-909f42c088f5'
      

      3. Add aspect cm:titled to FILE2.txt and property cm:description with some value on it (use the corresponding noderef): 

      curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -u admin:alfresco -d '{
        "aspectNames": [ "cm:titled" ],
        "properties":
         {
            "cm:description":"test"
          }
        }' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/086c4b7e-3262-4aee-ad6f-44c4715d34d3'
      

      4. Do a facet query using the search api (use POSTMAN):

      POST request http://node1:8080/alfresco/api/-default-/public/search/versions/1/search
      
      PAYLOAD
      
       {
        "query": {
          "language": "afts",
          "query": "cm:name:\"FILE*\""
        },
        "paging": {
          "maxItems": 100,
          "skipCount": 0
        },
        "include": [
          "properties"
        ],
        "templates": [
          {
            "name": "custom",
            "template": "%cm:content"
          }
        ],
        "sort": [
          {
            "type": "FIELD",
            "field": "cm:modified",
            "ascending": false
          }
        ],
        "filterQueries": [
          {
            "query": "TYPE:\"cm:content\""
          }
        ],
        "facetFields": {
          "facets": [
            {
              "field": "cm:description",
              "mincount": 1,
              "limit": 100
            }
          ]
        }
      }
      

      Expected behaviour:

      Label element shows up in every bucket:

      {
        "facetsFields": [
          {
            "label": "cm:description",
            "buckets": [
              {
                "label": "",    <------------------------ EXPECTED LABEL!!
                "filterQuery": "cm:description:\"\"",
                "count": 1
              },
              {
                "label": "test",
                "filterQuery": "cm:description:\"test\"",
                "count": 1
              }
            ]
          }
        ]
      }
      

      Observed behaviour:

      Label is missing when has empty value (""):

      {
        "facetsFields": [
          {
            "label": "cm:description",
            "buckets": [
              {
                "filterQuery": "cm:description:\"\"",
                "count": 1
              },
              {
                "label": "test",
                "filterQuery": "cm:description:\"test\"",
                "count": 1
              }
            ]
          }
        ]
      }
      

        Attachments

          Issue Links

            Structure

              Activity

                People

                • Assignee:
                  closedbugs Closed Bugs
                  Reporter:
                  folcina Francisco Olcina Grande
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Structure Helper Panel