Module Contents



Allows efficient pagination for a small specified set of queries.

class core.indexes.IndexMannager(pageSize=10, maxPages=100)

Allows efficient pagination for a small specified set of queries. This works only if the number of different querys is limited. Otherwise use the built-in page parameter for small result-sets and few pages. If you have lots of different querys and large result-sets you can only generate next/previous links on the fly.


The refreshAll Method is missing - intentionally. Whenever data changes you have to call refreshIndex for each affected Index. As long as you can name them, their number is limited and everything is fine :)

_dbType = viur_indexes
keyFromQuery(self, query)

Derives a unique Database-Key from a given query. This Key is stable regardless in which order the filter have been applied


query (DB.Query) – Query to derive key from



getOrBuildIndex(self, origQuery)

Builds a specific index based on origQuery AND local variables (self.indexPage and self.indexMaxPage) Returns a list of starting-cursors for each page. You probably shouldn’t call this directly. Use cursorForQuery.


origQuery (db.Query) – Query to build the index for



cursorForQuery(self, query, page)

Returns the starting-cursor for the given query and page using an index.

  • query (db.Query) – Query to get the cursor for

  • page (int) – Page the user wants to retrieve


Cursor (type: str) or None if no cursor is applicable

getPages(self, query)

Returns a list of all starting-cursors for this query. The first element is always None as the first page doesn’t have any start-cursor

refreshIndex(self, query)

Refreshes the Index for the given query (Actually it removes it from the db so it gets rebuild on next use)


query (db.Query) – Query for which the index should be refreshed