feat(stellar): add indexed get_campaigns_by_tag query (#540) - #732
Open
thebabalola wants to merge 1 commit into
Open
feat(stellar): add indexed get_campaigns_by_tag query (#540)#732thebabalola wants to merge 1 commit into
thebabalola wants to merge 1 commit into
Conversation
…ag-based discovery (Iris-IV#540) Implements efficient tag-based campaign discovery with index. Changes: - Add tags field to Campaign struct for storing campaign tags - Add TagCampaigns storage key for efficient tag indexing - Add get_campaigns_by_tag query with O(1) tag lookups - Update list_active_campaigns to use indexed tag filtering when available - Add get_campaigns_by_tag public contract method - Update campaign creation to populate tag index Benefits: - O(1) tag lookups instead of O(n) linear scan - Efficient pagination support for tag-based campaigns - Maintains existing backward compatibility with category queries - Enables scalable tag-based discovery for the frontend Closes Iris-IV#540
Author
|
hey, implemented the indexed get_campaigns_by_tag query for #540. added tags field to Campaign struct, tag indexing in storage, and the new query function. the tag lookup is O(1) instead of the previous O(n) scan. ready for review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Adds efficient tag-based campaign discovery to the ProofOfHeart-stellar contract.
Changes Made:
Added
tagsfield to Campaign struct insrc/types.rs:Added TagCampaigns key to storage system in
src/storage.rs:CampaignKey::TagCampaigns(String)to enumget_tag_campaign_countfunctionAdded query function in
src/queries.rs:get_campaigns_by_tagfunction with O(1) tag lookupsAdded contract method in
src/lib.rs:get_campaigns_by_tagmethod for external accessUpdated imports where needed to include new functions
Key Benefits:
Addresses Issue #540
This change addresses the RFE for "add indexed get_campaigns_by_tag(tag: String) query for efficient tag-based discovery".