Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fuzzy and operator usage when handling IS requests #2568

Merged
merged 8 commits into from
Nov 21, 2024
Merged

Conversation

pedromtec
Copy link
Contributor

@pedromtec pedromtec commented Nov 18, 2024

What's the purpose of this pull request?

This PR aims to correct fuzzy and operator usage when handling Intelligent Search API requests.

Previously, we specified a default value for fuzzy fuzzy=auto. But we shouldn’t include it on the first request to Search. According to the IS team, the correct behavior should let the search engine decide the best parameters for the search.

Re-applies changes made from #2204 without adding the blink effect added previously.

  • Adds fuzzy & operator parameters in the query
  • Avoid re-rendering the page
  • Check search PLP (blink issue)
  • Check category PLP (blink issue)
  • Check duplicate search.query event to IS

How it works?

More details on #2204 description.

How to test it?

Run the project locally or test though this preview link

Testing search PLP

  1. Search for apple using the input search field
  2. Open the Network Tab and filter for ClientProductGalleryQuery
  • In the first request ->Response tab: look for metadata object, the fuzzy and logicalOperator values
image
  • Check if the same values is being set in selectedFacets
image
  • You shouldn't see any blink effect in the page in this scenario:
search_apple.mov

Testing in Category PLP

  1. Click on Technology category
  2. You shouldn't see any blink effect in the page in this scenario

Duplicate Search event in PLP

  1. Search for apple using the input search field (at once)
  2. Open the Network Tab and filter for event
  3. You shouldn't be able to see the event (with the same url and term) being send twice
image

Starters Deploy Preview

vtex-sites/starter.store#617

References

#2204

Copy link

vercel bot commented Nov 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
faststore-site ⬜️ Ignored (Inspect) Visit Preview Nov 21, 2024 3:45pm

Copy link

codesandbox-ci bot commented Nov 18, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@hellofanny hellofanny changed the title Poc/fuzzy Poc: fix fuzzy usage when handling IS requests Nov 18, 2024
@hellofanny hellofanny changed the title Poc: fix fuzzy usage when handling IS requests fix: fuzzy and operator usage when handling IS requests Nov 18, 2024
@@ -97,4 +111,29 @@ export const useProductGalleryQuery = ({
}
},
})

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main change that differ from #2204

@hellofanny hellofanny marked this pull request as ready for review November 18, 2024 23:31
@hellofanny hellofanny requested a review from a team as a code owner November 18, 2024 23:31
@hellofanny hellofanny requested review from eduardoformiga and renatomaurovtex and removed request for a team November 18, 2024 23:31
@hellofanny hellofanny requested review from lucasfp13 and lariciamota and removed request for renatomaurovtex November 18, 2024 23:32
Copy link
Member

@eduardoformiga eduardoformiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing Job, folks! ⭐
It's good to see this topic addressed.

I left just one comment regarding the analytics event that we can double-check with the IS team. But it's non-blocking.

Copy link
Contributor

@lariciamota lariciamota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! ✨

## What's the purpose of this pull request?

Follow-up of #2568

We are currently sending `search.query` events type instead of
`search.autocomplete.query` when typing a term in the search input. This
may be affecting some metrics.

## How to test it?

Run the project locally or test though this [preview
link](https://sfj-029e21e--starter.preview.vtex.app/)
1. Type `apple` in the input search field and press enter (you can
slowly type it)
2. Open the `Network Tab` and filter for `event`

- You might see some events with `type: "search.autocomplete.query"`

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/5338b6f0-c6e3-4c21-ac6a-b76b8b452108">

- The last event with the full text should have` type: "search.query"`
(and it should be the only event with this type).

<img width="921" alt="image"
src="https://github.com/user-attachments/assets/37373716-61b6-405b-b51f-52a88a99836a">



### Starters Deploy Preview

vtex-sites/starter.store#618

## References

[Slack
thread](https://vtex.slack.com/archives/CP6S9HP46/p1720788576536359?thread_ts=1719365308.548959&cid=CP6S9HP46)
@hellofanny hellofanny merged commit a5bf0c6 into main Nov 21, 2024
8 checks passed
@hellofanny hellofanny deleted the poc/fuzzy branch November 21, 2024 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants