-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 9.10, 10.3
-
Component/s: Elasticsearch
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>
- is related to
-
NXP-27168 Fix NXQL operator ILIKE when querying elasticsearch
- Resolved