From 71772349e7d034f805970886f0f5d3125a6a0626 Mon Sep 17 00:00:00 2001 From: Jaak Tamre Date: Mon, 17 Apr 2017 11:15:34 +0300 Subject: [PATCH] Fix paramsBoostedFields and paramsFilterFields According to documentation: http://actionml.com/docs/ur_config fields: optional, default = none. An array of ... . Positive biases are boosts any negative number will filter out any results that do not contain the values in the field name. When adding fields to algorithm parameters with a negative bias (-1) they will not be filtered, but instead added as boosted fields with a negative value. Providing a positive number will cause this to be a filter. If you look at the annotations, someone has tried to fix this but instead of swapping the ">" and "<", he moved "=" instead. I have corrected this issue --- src/main/scala/URAlgorithm.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/URAlgorithm.scala b/src/main/scala/URAlgorithm.scala index e6cb570..1e69836 100644 --- a/src/main/scala/URAlgorithm.scala +++ b/src/main/scala/URAlgorithm.scala @@ -738,7 +738,7 @@ class URAlgorithm(val ap: URAlgorithmParams) /** get all metadata fields that potentially have boosts (not filters) */ def getBoostedMetadata(query: Query): Seq[BoostableCorrelators] = { - val paramsBoostedFields = fields.filter(_.bias < 0f) + val paramsBoostedFields = fields.filter(_.bias >= 0f) val queryBoostedFields = query.fields.getOrEmpty.filter(_.bias >= 0f) (queryBoostedFields ++ paramsBoostedFields) @@ -748,7 +748,7 @@ class URAlgorithm(val ap: URAlgorithmParams) /** get all metadata fields that are filters (not boosts) */ def getFilteringMetadata(query: Query): Seq[FilterCorrelators] = { - val paramsFilterFields = fields.filter(_.bias >= 0f) + val paramsFilterFields = fields.filter(_.bias < 0f) val queryFilterFields = query.fields.getOrEmpty.filter(_.bias < 0f) (queryFilterFields ++ paramsFilterFields)