Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-26419

Fix filtering on task name in content view 'user_open_tasks' when using elasticsearch

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 9.10, 10.3
    • Fix Version/s: 9.10-HF25, 10.10
    • Component/s: Elasticsearch
    • Release Notes Summary:
      The content view 'user_open_tasks' is compatible with Elasticsearch.
    • Tags:
    • Backlog priority:
      800
    • Sprint:
      nxcore 10.10.4
    • Story Points:
      1

      Description

      When content view user_open_tasks is configured to use ES, filtering on the task name (in the search from) filters out the results even though it should show results.

      How to reproduce:

      • in nuxeo.conf, add user_open_tasks to configuration variable elasticsearch.override.pageproviders
      • restart the Nuxeo Platform
      • in JSF UI, start a Serial document review workflow on a document
      • navigate to HOME > Workflow, the content view lists 1 task
      • in the content view's search form, set field Task Name to [Serial document review] Choose Participants and click the Filter button

      Expected result: 1 task is listed by the content view
      Actual result: no task is listed by the content view

      It is because the predicate for task name uses the ILIKE operator. When it is converted to a ES DSL query it adds a wildcard part to the query like this:

      curl -XGET 'http://elasticsearch:9200/nuxeo/doc/_search?pretty&search_type=dfs_query_then_fetch' -d '{
        "from" : 0,
        "size" : 10,
        "query" : {
          "bool" : {
            "must" : [
              {
                "wildcard" : {
                  "nt:name.lowercase" : {
                    "wildcard" : "wf.serialdocumentreview.documentvalidation",
                    "boost" : 1.0
                  }
                }
              },
              {
                "bool" : {
                  "must" : [
                    {
                      "constant_score" : {
                        "filter" : {
                          "terms" : {
                            "ecm:mixinType" : [
                              "RoutingTask"
                            ],
                            "boost" : 1.0
                          }
                        },
                        "boost" : 1.0
                      }
                    },
                    {
                      "constant_score" : {
                        "filter" : {
                          "term" : {
                            "ecm:isVersion" : {
                              "value" : "0",
                              "boost" : 1.0
                            }
                          }
                        },
                        "boost" : 1.0
                      }
                    },
                    {
                      "constant_score" : {
                        "filter" : {
                          "term" : {
                            "ecm:currentLifeCycleState" : {
                              "value" : "opened",
                              "boost" : 1.0
                            }
                          }
                        },
                        "boost" : 1.0
                      }
                    },
                    {
                      "constant_score" : {
                        "filter" : {
                          "term" : {
                            "ecm:isProxy" : {
                              "value" : "0",
                              "boost" : 1.0
                            }
                          }
                        },
                        "boost" : 1.0
                      }
                    }
                  ],
                  "disable_coord" : false,
                  "adjust_pure_negative" : true,
                  "boost" : 1.0
                }
              }
            ],
            "disable_coord" : false,
            "adjust_pure_negative" : true,
            "boost" : 1.0
          }
        },
        "_source" : {
          "includes" : [
            "_id"
          ],
          "excludes" : [ ]
        }
      }'
      

      Without the query part, it gives all the open tasks.

      Workaround: use operator = instead of ILIKE for the task name predicate, here is a XML extension:

        <require>org.nuxeo.ecm.platform.routing.dashboard.contentviews</require>
      
        <extension target="org.nuxeo.ecm.platform.ui.web.ContentViewService"
          point="contentViews">
      
          <contentView name="user_open_tasks">
            <showTitle>false</showTitle>
            <coreQueryPageProvider>
              <property name="coreSession">#{documentManager}</property>
              <whereClause docType="user_open_tasks_cv">
                <predicate operator="LIKE" parameter="nt:processId">
                  <field name="task_processId" schema="user_open_tasks_cv"/>
                </predicate>
                <predicate operator="=" parameter="nt:name">
                  <field name="task_name" schema="user_open_tasks_cv"/>
                </predicate>
                <predicate operator="BETWEEN" parameter="nt:dueDate">
                  <field name="task_dueDate_min" schema="user_open_tasks_cv"/>
                  <field name="task_dueDate_max" schema="user_open_tasks_cv"/>
                </predicate>
                <fixedPart>
                  ecm:mixinType IN ('RoutingTask') AND
                  ecm:isCheckedInVersion = 0 AND
                  ecm:currentLifeCycleState =
                  'opened' AND ecm:isProxy = 0
                </fixedPart>
              </whereClause>
              <pageSize>10</pageSize>
            </coreQueryPageProvider>
          </contentView>
      
        </extension>
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 10 minutes
                  10m

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.