Skip to content

Commit

Permalink
fix filter when not including kw search
Browse files Browse the repository at this point in the history
  • Loading branch information
v9n committed Aug 27, 2024
1 parent 8208b98 commit 8f9492a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion finder/common/finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ func PriceFromRequest[T Inventory](priceData map[string]T, requestRegion string,
// We start, default to a not match, and looking for item that has a
// match
matched := false
hasTextSerch := false

for _, kw := range keywords {
if kw.IsText() {
hasTextSerch = true
switch kw.TextOp {

case ExcludeOpType:
Expand Down Expand Up @@ -65,7 +67,7 @@ func PriceFromRequest[T Inventory](priceData map[string]T, requestRegion string,
}
}

if !matched {
if hasTextSerch && !matched {
// bail early if the keyword isn't a match
continue
}
Expand Down

0 comments on commit 8f9492a

Please sign in to comment.