api icon indicating copy to clipboard operation
api copied to clipboard

Fix multiple bugs in confidence score handling

Open orangejulius opened this issue 5 years ago • 1 comments

There were multiple issues with the fallback query confidence score calculation middleware.

  1. Incorrect detection of handled query types. Essentially, the logic was negated
  2. Incorrect list of supported query types. Not all list entries matched the actual query names
  3. Incorrect parameter in mock data for unit tests. This combined with the first bug to mask the issue in unit tests

Fixes https://github.com/pelias/api/issues/1280

orangejulius avatar Jul 15 '19 16:07 orangejulius

Looking at the acceptance test output, merging this might actually be problematic. It turns out a large number of queries return confidence scores from the newer, confidenceScoreFallback middleware. This middleware sets the match_type property (to, for example, exact, fallback or interpolated).

We already identified in https://github.com/pelias/pelias/issues/739 that the inconsistency in returning the match_type property is problematic for API consumers. Unfortunately, this would make that problem more prevalent.

It might be nice to figure out a reasonable way to set match_type for all queries before merging this.

Additionally, the confidence score detection in confidenceScoreFallback is "better": it returns 1 for exact matches that are truly correct a lot more frequently.

Combining the two middleware modules might be a win for behavior and code complexity (similar to https://github.com/pelias/api/pull/1314).

orangejulius avatar Jul 15 '19 17:07 orangejulius