Update pipeline for partial PIS match

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-10-12 22:04:03 +01:00
parent e3097b1af9
commit f37d423597
1 changed files with 4 additions and 4 deletions

View File

@ -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,