Questions asked by lttunghttps://answers.axonivy.com/questions/asked-by/558/lttung/?type=rssQuestions asked by <a href="/users/558/lttung" >lttung</a>enMon, 17 Jul 2017 05:43:16 -0400Exception when querying business data with sortinghttps://answers.axonivy.com/questions/2763/exception-when-querying-business-data-with-sorting<p>Hi ivyTeam</p> <p>Querying data from business data </p> <pre><code>repo().search(getType()).orderBy().textField("processName").ascending().execute().getAll(); </code></pre> <p>It throws the exception:</p> <pre><code>Caused by: ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.ElasticsearchException: Elasticsearch search documents failed because of: {"root_cause":[{"type":"search_parse_exception","reason":"No mapping found for [processName.ascii] in order to sort on"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"ivy.businessdata","node":"swxYYakvQMCJMMyVDyQhfA","reason":{"type":"search_parse_exception","reason":"No mapping found for [processName.ascii] in order to sort on"}}]} at ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.JestOperation.checkStatusAndThrow(JestOperation.java:62) at ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.JestOperation.execute(JestOperation.java:40) at ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.JestSearcher.search(JestSearcher.java:32) at ch.ivyteam.ivy.business.data.store.search.internal.ResultImpl.execute(ResultImpl.java:38) at ch.ivyteam.ivy.business.data.store.search.internal.QueryImpl.raw(QueryImpl.java:128) at ch.ivyteam.ivy.business.data.store.search.internal.QueryImpl.executeQuery(QueryImpl.java:174) at ch.ivyteam.ivy.business.data.store.search.internal.QueryImpl.execute(QueryImpl.java:107) at ch.ivyteam.ivy.business.data.store.search.internal.OrderByFieldOrLimitImpl.execute(OrderByFieldOrLimitImpl.java:29) at ch.ivy.addon.portalkit.service.ExpressProcessService.findAllOrderByName(ExpressProcessService.java:11) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at ch.ivyteam.ivy.scripting.internal.types.IvyJavaMethod.invokeImpl(IvyJavaMethod.java:73) ... 280 more </code></pre> <p>It happens on Axon.ivy Engine RC-6.6.2.55064. In designer, sometimes it happens as well. Could you please guide us how to fix the problem?</p>lttungMon, 17 Jul 2017 05:43:16 -0400https://answers.axonivy.com/questions/2763/exception-when-querying-business-data-with-sortingbusiness-dataelasticsearchExtend Task Json Queryhttps://answers.axonivy.com/questions/2629/extend-task-json-query<p>I have a Task Query as json to filter tasks by states: SUSPENDED, RESUMED, PARKED and order by priority:</p> <pre><code>TaskQuery stateQuery = TaskQuery.create().where().state().isEqual(TaskState.SUSPENDED).or().state().isEqual(TaskState.RESUMED).or().state().isEqual(TaskState.PARKED).orderBy().priority(); </code></pre> <p>After that, I would like to extend this query: filtering by ((suspended or resumed or parked states) and applicationId) order by priority but it is not as my expectation:</p> <pre><code>Way 1: TaskQuery.fromJson(stateQueryJson).where().and().applicationId().isEqual(1); </code></pre> <p>The result: SELECT * FROM IWA_Task WHERE (Column(IWA_TaskQuery.State) = 4 || Column(IWA_TaskQuery.State) = 5 || (Column(IWA_TaskQuery.State) = 8 &amp;&amp; Column(IWA_TaskQuery.ApplicationId) = 1)) ORDER BY Column(CurrentPriority) ASCENDING</p> <p>==&gt; <strong>Tasks with Suspended state and Resumed state are not filtered by applicationId</strong></p> <pre><code>Way 2: TaskQuery.create().where().and(TaskQuery.fromJson(stateQuery.asJson())).and().applicationId().isEqual(1) </code></pre> <p>The result: SELECT * FROM IWA_Task WHERE ((Column(IWA_TaskQuery.State) = 4 || Column(IWA_TaskQuery.State) = 5 || Column(IWA_TaskQuery.State) = 8) &amp;&amp; Column(IWA_TaskQuery.ApplicationId) = 1) </p> <p>==&gt; <strong>Priority order is lost</strong></p> <p>Do you have any suggestions? Or is it a bug of task json query?</p>lttungThu, 18 May 2017 02:59:45 -0400https://answers.axonivy.com/questions/2629/extend-task-json-queryivytask-query