关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。
想改进这个问题?将问题更新为 on-topic对于堆栈溢出。
7年前关闭。
Improve this question
def score = 0;
// terms: list of tokens
for(term in terms) {
q_term_freq = terms.countBy { it }[term]; // for frequency of each term in terms
term_freq = _index[field][term].tf();
doc_freq = _index[field][term].df();
score += term_freq * doc_freq * q_term_freq;
};
score;
当我运行它时,我得到一个错误`GroovyScriptExecutionException[MissingPropertyException[No such property: terms\u200b for class: Script86.
出了什么问题?阿法克
countBy
是有效的功能。
最佳答案
\u200b
是零宽度空间的 unicode。
重写脚本或确保 terms
中不存在 unicode 字符.
关于groovy - 为 "function_score"运行 groovy 脚本时出现问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28184611/