From f37d4235971823af6da9504d0328bf23a68cb96c Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 12 Oct 2023 22:04:03 +0100 Subject: [PATCH] Update pipeline for partial PIS match Signed-off-by: Fred Boniface --- src/services/pis.services.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/pis.services.ts b/src/services/pis.services.ts index d919a89..433fc77 100644 --- a/src/services/pis.services.ts +++ b/src/services/pis.services.ts @@ -64,8 +64,8 @@ async function findPartialMatchByTiploc(tiplocArray: string[]) { const pipeline = [ { $addFields: { - reversedStops: { - $reverseArray: "$stops", + reversedTiplocs: { + $reverseArray: "$tiplocs", }, reversedQueryArray: { $reverseArray: tiplocArray, @@ -78,7 +78,7 @@ async function findPartialMatchByTiploc(tiplocArray: string[]) { $gt: [ { $indexOfArray: [ - "$reversedStops", + "$reversedTiplocs", { $arrayElemAt: ["$reversedQueryArray", 0], } @@ -95,7 +95,7 @@ async function findPartialMatchByTiploc(tiplocArray: string[]) { skipStops: { $subtract: [ { - $size: "$stops", + $size: "$tiplocs", }, { $size: tiplocArray,