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;), is(java.lang.Object), with(groovy.lang.Closure)]]
This sounds to me like the function for getting a millisecond timestamp is different in Groovy. I tried System.currentTimeMillis()
, but it gave another error saying it didn't support imports.
So how can I fix the time()
function to work with Groovy?