-
Notifications
You must be signed in to change notification settings - Fork 0
jayden/basic-query-implement #25
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
Draft
BayernMuller
wants to merge
9
commits into
team/query-with-index
Choose a base branch
from
jayden/basic-query-implement
base: team/query-with-index
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fa38f65
feat: implement Find method in DOMQuery to retrieve nodes by ID
BayernMuller 7c8028f
refactor: replace vector with unordered_set for classes in HtmlToken …
BayernMuller 17f6b75
refactor: change classes return type from vector to unordered_set in …
BayernMuller 16818c8
feat: add GetNodesByAttribute method to DOMIndexer for querying nodes…
BayernMuller d0ed5f1
refactor: update QueryOptions to use ClassSet and AttributeMap for im…
BayernMuller 3b6e466
feat: add utility functions for subset checks in unordered_set and un…
BayernMuller ecdcc0a
refactor: replace attributes and classes in HtmlToken with type alias…
BayernMuller 4cc3de2
refactor: update return types of attributes and classes in TagNode to…
BayernMuller 42c315e
feat: implement searchCandidatesFromIndexer and matchAllConditions me…
BayernMuller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * Copyright 2025 Team Arboris | ||
| * Licensed under the Apache License, Version 2.0 | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
|
|
||
| #ifndef SRC_UTILS_SET_UTILS_HPP_ | ||
| #define SRC_UTILS_SET_UTILS_HPP_ | ||
|
|
||
| #include <unordered_map> | ||
| #include <unordered_set> | ||
|
|
||
| namespace arboris { | ||
|
|
||
| template <typename T> | ||
| bool IsSubset(const std::unordered_set<T>& subset, | ||
| const std::unordered_set<T>& super_set) { | ||
| if (subset.size() > super_set.size()) { | ||
| return false; | ||
| } | ||
|
|
||
| for (const auto& x : subset) { | ||
| // std::unordered_set::contains is available in C++20 | ||
| if (!super_set.contains(x)) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| template <typename T, typename U> | ||
| bool IsSubset(const std::unordered_map<T, std::unordered_set<U>>& subset, | ||
| const std::unordered_map<T, std::unordered_set<U>>& super_set) { | ||
| for (const auto& [key, value_set] : subset) { | ||
| auto it = super_set.find(key); | ||
| if (it == super_set.end()) { | ||
| return false; | ||
| } | ||
| if (!IsSubset(value_set, it->second)) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| } // namespace arboris | ||
|
|
||
| #endif // SRC_UTILS_SET_UTILS_HPP_ |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
searchCandidatesFromIndexer에서 이미 전체 Dom에 대해 모든option들에 대한 쿼리를 진행 했는데, 여기서 다시 모든option에 대한 검사를 중복해서 수행하는게 비효율적으로 보임.searchCandidatesFromIndexer에서 각option에 대해 한 번에 할 수 있어보임.e.g.,
tag쿼리 결과NodeList생성class에 대한 쿼리 진행 (Dom 전체가 아닌 이전 결과NodeList에서 걸러내기)코드가 더러울거 같긴 한데, 조금 다듬어 보면 괜찮게 나올지도?