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

Concepts #571

Merged
merged 3 commits into from
Feb 11, 2024
Merged

Concepts #571

merged 3 commits into from
Feb 11, 2024

Conversation

elshize
Copy link
Member

@elshize elshize commented Jan 21, 2024

This change set contains commits that introduce C++20 concepts for:

  • mappings,
  • posting lists,
  • inverted index.

Concepts are only used when compiled in C++20 mode, ignored otherwise.

Assertions are added to known structures that satisfy these concepts.

Some require constraints are also added, most notably for the algorithm execution that expect certain posting lists.

Rationale

Concepts are introduced for faster constraint checking and explicit interface modeling when templates are used.

Copy link

codecov bot commented Jan 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (637254f) 93.28% compared to head (25bfefc) 93.29%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #571   +/-   ##
=======================================
  Coverage   93.28%   93.29%           
=======================================
  Files          90       90           
  Lines        4454     4457    +3     
=======================================
+ Hits         4155     4158    +3     
  Misses        299      299           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@elshize elshize force-pushed the concepts branch 2 times, most recently from fa01b20 to dd1ce20 Compare January 21, 2024 15:02
@elshize elshize force-pushed the concepts branch 2 times, most recently from 806bbb6 to 84ca85d Compare February 8, 2024 00:54
Copy link
Member

@JMMackenzie JMMackenzie left a comment

Choose a reason for hiding this comment

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

This looks great! A few repeated comments about API changes throughout.

include/pisa/term_map.hpp Show resolved Hide resolved
include/pisa/term_map.hpp Show resolved Hide resolved
test/in_memory_index.cpp Show resolved Hide resolved
Introduce mapping concepts and use concept asserts for `TermMap` and its
subclasses.

Changelog-changed: `TermMap` uses `find` method instead of `operator()`
 for reverse lookup (string to int)
Signed-off-by: Michal Siedlaczek <michal@siedlaczek.me>
Introduce posting list concepts & use them in the algorithms.

Signed-off-by: Michal Siedlaczek <michal@siedlaczek.me>
Add inverted index concepts and static assertions for the existing index
classes.

Signed-off-by: Michal Siedlaczek <michal@siedlaczek.me>
@elshize elshize merged commit acb8fb8 into master Feb 11, 2024
10 checks passed
@elshize elshize deleted the concepts branch February 11, 2024 23:38
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.

2 participants