Skip to content

Conversation

claygriffiths
Copy link
Contributor

Summary

Added new snippet that adds a "Fuzzy Match" property available to all object types.

Utilizes Fuse-like logic to search through returned objects.

Depends on https://github.com/gravitywiz/gp-populate-anything/commit/949ab5a471c27c9d2837bc8c07cf89963c11109f

Known Limitations

  • This uses PHP-based logic for filtering, so the filtering is done after the object type returns the objects. In other words, if the results are already cut off due to limiting, this won't surface objects that were not already returned.

Copy link

coderabbitai bot commented Sep 5, 2025

Warning

Rate limit exceeded

@claygriffiths has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 20 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c29fa76 and 10ae594.

📒 Files selected for processing (1)
  • gp-populate-anything/gppa-fuzzy-match-property.php (1 hunks)

Walkthrough

Adds a new singleton class that registers a global “Fuzzy Match” property for all GPPA object types and applies fuzzy matching to object query results via WordPress filters. Implements multi-algorithm similarity scoring, template-driven content extraction, and supports contains/does_not_contain operators during result filtering.

Changes

Cohort / File(s) Summary
Fuzzy Match property & filtering
gp-populate-anything/gppa-fuzzy-match-property.php
Introduces GPPA_Fuzzy_Match_Property singleton. Registers filters to add a global fuzzy_match property and to apply fuzzy matching to gppa_object_type_query_results. Implements content extraction, normalization, template processing, multi-method similarity scoring, and operators contains/does_not_contain with thresholding and sorting.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant WP as WordPress
  participant GPPA as GP Populate Anything
  participant Fuzzy as GPPA_Fuzzy_Match_Property
  participant ObjType as Object Type Instance

  Note over Fuzzy: Initialization
  WP->>Fuzzy: init()
  Fuzzy->>WP: add_filter(gppa_object_type_properties)
  Fuzzy->>WP: add_filter(gppa_object_type_query_results)

  Note over GPPA,ObjType: Query lifecycle
  GPPA->>ObjType: fetch_objects(args)
  ObjType-->>GPPA: objects[]

  GPPA->>Fuzzy: apply_fuzzy_matching(objects[], object_type_instance, args)
  alt Fuzzy filters present
    Fuzzy->>Fuzzy: extract fuzzy filters from args.filter_groups
    loop For each fuzzy filter
      Fuzzy->>Fuzzy: expand value (field values, replace_gf_field_value)
      Fuzzy->>Fuzzy: extract_searchable_content(objects[])
      Fuzzy->>Fuzzy: fuzzy_search(content[], query)
      Fuzzy-->>Fuzzy: matched set (scored/sorted)
      Fuzzy->>Fuzzy: include/exclude per operator (contains / does_not_contain)
    end
    Fuzzy-->>GPPA: filtered objects[]
  else No fuzzy filters
    Fuzzy-->>GPPA: original objects[]
  end

  GPPA-->>WP: final objects[]
  Note right of WP: Results rendered
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch clay/add/gppa-fuzzy-match

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Sep 5, 2025

Warnings
⚠️ When ready, don't forget to request reviews on this pull request from your fellow wizards.

Generated by 🚫 dangerJS against 10ae594

@claygriffiths claygriffiths force-pushed the clay/add/gppa-fuzzy-match branch 2 times, most recently from c29fa76 to 14700c2 Compare September 5, 2025 15:04
… Match" property available to all object types.
@claygriffiths claygriffiths force-pushed the clay/add/gppa-fuzzy-match branch from 14700c2 to 10ae594 Compare September 5, 2025 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant