def score = 0;
// terms: list of tokens
for(term in terms) {
q_term_freq = terms.countBy { it }[term];
term_freq = _index[field][term].tf();
doc_freq = _index[field][term].df();
score += term_freq * doc_freq * q_term_freq;
};
score;
The first one gives an error
"GroovyScriptExecutionException[MissingPropertyException[No such property:
terms\u200b for class: Script86". "q_term_freq" gives a mapping for a term
to its frequency.
def score = 0;
// terms: list of tokens
for(term in terms) {
q_term_freq = terms.countBy { it }[term];
term_freq = _index[field][term].tf();
doc_freq = _index[field][term].df();
score += term_freq * doc_freq * q_term_freq;
};
score;
The first one gives an error "GroovyScriptExecutionException[MissingPropertyException[No
such property: terms\u200b for class: Script86". "q_term_freq" gives a
mapping for a term to its frequency.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.