Commit e09bcae4 authored by Rob Tomsick's avatar Rob Tomsick

Add FIXME for a search improvement

parent f97d118e
......@@ -237,6 +237,20 @@ implements DictionaryService
public List<Product>
findProducts(final String query, int limit)
/* FIXME - "valsartin" produces poor result ordering
* This search approach has one big hole:
* "valsartin" produces a top result of
* "Valsartan and hydrochlorothiazide" and not "Valsartan" as it
* should. Without debugging this, my guess is that both hits are
* scored the same because we're looking at proprietary name, but
* ignoring the fact that a multi-ingredient product should be ranked
* lower than a single-ingredient product in cases where we have only
* one input word.
if (StringUtils.isEmpty(query) || limit < 1)
return Collections.emptyList();
......@@ -251,6 +265,7 @@ implements DictionaryService
final Field<UUID> idField = field(name("id"), UUID.class);
final Function<NDCProduct, Pair<NDCProduct, Double>> scoreMapper =
product -> Pair.of(product, scoreProduct(product, term));
final Comparator<Pair<?, Double>> pairSort =
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment