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

PluginIndexes.Unindex.query_index seems to be overly complex and should be refactored #56

Open
d-maurer opened this issue Mar 7, 2019 · 0 comments

Comments

@d-maurer
Copy link
Contributor

d-maurer commented Mar 7, 2019

  • Its docstring is misleading
  • There is duplicate code for cache and not_param handling
  • Why is caching handled differently for operator "or" and not "or" (likely "and"). We could either cache in both cases a "setlist" or in both cases a set (with in the "and" case the intersection of the current "setlist"s).
    Do we need this caching at all? How often do we have the same index query (with identical parameters) in the same request?

I propose the following new structure:

  • we determine the cache key and obtain a cached result: either None or a sequence of sets
  • if the cache has no result, we determine from record a sequence of keys to be looked up; for "and", the intermediate result is the sequence of looked up document sets, ordered by len (note that determining the size of an IITreeSet loads all buckets from the ZODB; if this requires real storage accesses, then this length determination can even be more expensive than performing the intersection directly); for "or", the result is the one element sequence of the "multiunion" of the looked up document sets. Cache the intermediate result
  • Intersect with resultset and return the final result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant