mvel

EqualsIgnoreCase on Drools

狂风中的少年 提交于 2020-06-18 11:16:08
问题 I am trying to rewrite my drl from using regex to equalsIgnoreCase as I think its faster. I am not sure its faster though. However, drools doesn't like it for some reason and I get unknown error. The one on top works, but the one using equalsIgnoreCase doesn't rule "name" salience 0 activation-group "flow" dialect "mvel" no-loop true when $vurderinger: Vurderinger(vurdering1909 != null && vurdering1909.verdi matches "(?i)^FOO$") then modify( $vurderinger ) { setVurdering1913(new DroolsType(

更改Web根目录

微笑、不失礼 提交于 2020-04-16 16:48:38
【推荐阅读】微服务还能火多久?>>> 配置缓存 默认情况下,静态处理程序将设置缓存标头以使浏览器能够有效地缓存文件。 Vert.x的Web设置标题 cache-control , last-modified 和 date 。 cache-control max-age=86400 默认设置为。这相当于一天。 setMaxAgeSeconds 如果需要,可以配置它 。 如果浏览器发送带有 if-modified-since 标头的GET或HEAD请求,并且该资源自该日期起未被修改, 304 则返回状态,告知浏览器使用其本地缓存的资源。 如果不需要处理缓存头,则可以禁用它 setCachingEnabled 。 启用缓存处理后,Vert.x-Web将缓存内存中资源的最后修改日期,这样可以避免磁盘命中每次都检查实际的上次修改日期。 缓存中的条目具有到期时间,在此之后,将再次检查磁盘上的文件并更新缓存条目。 如果您知道您的文件永远不会在磁盘上更改,那么缓存条目将永远不会过期。这是默认值。 如果您知道在服务器运行时您的文件可能在磁盘上发生更改,那么您可以将只读文件设置为false setFilesReadOnly 。 要在任何时候启用可以在内存中缓存的最大条目数,您可以使用 setMaxCacheSize 。 要配置可以使用的缓存条目的到期时间 setCacheEntryTimeout 。

remove objects from array elastic search

…衆ロ難τιáo~ 提交于 2020-01-10 18:26:29
问题 I have required to remove object from array that satisfies the condition, I am able to update the object of array on the basis of condition, which is as follow: PUT twitter/twit/1 {"list": [ { "tweet_id": "1", "a": "b" }, { "tweet_id": "123", "a": "f" } ] } POST /twitter/twit/1/_update {"script":"foreach (item :ctx._source.list) { if item['tweet_id'] == tweet_id) { item['new_field'] = 'ghi'; } }", "params": {tweet_id": 123"} } this is working for remove i am doing this POST /twitter/twit/1/

remove objects from array elastic search

时间秒杀一切 提交于 2020-01-10 18:24:49
问题 I have required to remove object from array that satisfies the condition, I am able to update the object of array on the basis of condition, which is as follow: PUT twitter/twit/1 {"list": [ { "tweet_id": "1", "a": "b" }, { "tweet_id": "123", "a": "f" } ] } POST /twitter/twit/1/_update {"script":"foreach (item :ctx._source.list) { if item['tweet_id'] == tweet_id) { item['new_field'] = 'ghi'; } }", "params": {tweet_id": 123"} } this is working for remove i am doing this POST /twitter/twit/1/

remove objects from array elastic search

橙三吉。 提交于 2020-01-10 18:24:18
问题 I have required to remove object from array that satisfies the condition, I am able to update the object of array on the basis of condition, which is as follow: PUT twitter/twit/1 {"list": [ { "tweet_id": "1", "a": "b" }, { "tweet_id": "123", "a": "f" } ] } POST /twitter/twit/1/_update {"script":"foreach (item :ctx._source.list) { if item['tweet_id'] == tweet_id) { item['new_field'] = 'ghi'; } }", "params": {tweet_id": 123"} } this is working for remove i am doing this POST /twitter/twit/1/

How to pass arguments to a function written inside an MVEL expression?

一笑奈何 提交于 2020-01-04 02:26:28
问题 I have a JAVA class that has two methods. The first one is the main method and the second one is method1(). Let's say the following is the class: public class SomeClass() { public static void main(String[] args) { SomeClass myObj = new SomeClass(); Map<String,Object> map = new HashMap<String,Object>(); map.put("obj", myObj); MVEL.eval("System.out.println(\"I am inside main method\");obj.method1();",map); } public static void method1(List<String> listOfStrings){ System.out.println("I am inside

drools mvel for each element in a map

大城市里の小女人 提交于 2019-12-24 01:53:02
问题 One of the no-nos in drools includes manually iterating over collections in the consequence (then clause). I need to write a drool which is effectively iterating over a map while doing something for each key value pair in that map. In other words, I need to duplicate the behavior of a for-each loop in drools without actually writing a for-each loop. Now, I realize I could just write a for-each loop in the consequence. I want to keep my code as close to drools-standard as possible. I have

Mvel iterate a list

醉酒当歌 提交于 2019-12-22 08:50:50
问题 I have this class hierarchy StudentClass .java public class StudentClass { private List<Student> studentList; public List<Student> getStudentList() { return studentList; } public void setStudentList(List<Student> studentList) { this.studentList = studentList; } } Student.java public class Student { private Child child; private int studAge; public Student(Child child, int studAge) { this.child = child; this.studAge = studAge; } public Child getChild() { return child; } public void setChild

ElasticSearch Get Time in Groovy Script

北战南征 提交于 2019-12-22 08:39:54
问题 My application is using this script for boosting more recent items in the index: (5 / ((3.16*pow(10,-11)) * abs(time() - doc[\'date\'].date.getMillis()) + 0.2)) + 1.0 It's written in MVEL, but as of 1.3, MVEL is deprecated for Groovy. The script throws this error now: GroovyScriptExecutionException[MissingMethodException[No signature of method: Script4.time() is applicable for argument types: () values: []\nPossible solutions: find(), dump(), find(groovy.lang.Closure), use([Ljava.lang.Object;

elasticsearch aggregation using a script to transform field value being aggregated

馋奶兔 提交于 2019-12-21 04:44:07
问题 I currently have something like: "aggs": { "group_by_myfield": { "terms": { "field": "myfield" } } } However the value for myfield is "alpha 1.0", "alpha 2.0", "beta 1.0". Now I want to only aggregate over the values "alpha", "beta". How do I do that? I tried: "aggs": { "group_by_myfield": { "terms": { "field": "myfield" "script": "_value.split()[0]" } } } But I guess there is no split functionality. Any suggestions are welcome! I found a similar question here which is unanswered as well. 回答1