October CMS backend view pagination - pagination

I'm building a website that contains several thousand records. My backend listview of the items is terribly slow. I can't find out how to apply pagination in this view. There is documentation that states
$users = Db::table('tablename')->paginate(15);
I just don't know how to implement this code and where to do so.

In your list configuration, specify recordsPerPage.
The default is 0, but any other number will activate pagination:
So in config_list.yaml, use:
recordsPerPage: 20
See also: https://octobercms.com/docs/backend/lists

Related

SharePoint view limitation

I have a document library in SharePoint online. I keep on dumping the records into it. As SharePoint have a 5000 record view limitation the moment it reaches that limit, still I will be able to upload documents but it doesn't show up any where.
Eventually I end up creating a new view and apply a filter and then the document starts showing up under the new view.
My question here is: Is there a way to automatically create a view when it reaches the 5000 limitation and put the newly uploaded documents to the new view.
Yes, you can do this via MS Flow/Workflow & server side apps/scripts of course but it's not a good approach to the issue IMO.
Have you indexed the columns? I just tested this now on a document library with 20k documents and I'm able to filter. There are limitations which you should look into (complex filtering), that's where compound indexes come in.
If you still have issues then I recommend you give the highlighted content web-part a try. You can create custom search queries & it looks similar to a document library if u set the settings correctly. The only meh thing about this approach is there is a delay for search to update, from 15 mins to 6 hours depending on how much data you have

Kentico hierarchical viewer content filter "invalid column name" exception

I have a page that uses a hierarchical viewer with a content filter that filters on two page types, one a container and the other a leaf page. The container page type has no fields, the page does have several fields. In Hierarchical Viewer/Content Filter/Columns I list a few columns explicitly to return, as this helps performance.
We are upgrading from Kentico 8.2 to Kentico 9. In the 8.2 site, this page is working. In the 9 site, it is now throwing an exception saying "Invalid column name". If I remove the column list (allowing Kentico to return all columns by default), it works again. The performance hit isn't very noticeable, so this is a viable option. However, I'd like to know why this isn't working now in Kentico 9.
It seems like when returning all columns, by default, if a column isn't available on a page type, Kentico generates SELECT null as MissingColumnName, but when explicitly listing the columns to return, it generates SELECT MissingColumnName. I don't know if this is a change between Kentico 8.2 and 9, or if something got changed during the upgrade.
Pre version 9, Kentico created specific views for each page type. These views were used in the queries to retrieve page information. The views joined the node, document and custom page type information into one query. In v9 these views were removed and a generic view was added which only joins the node and document information together, then dynamically adds the custom page type information after.
So the short answer is the API changed significantly for the pages and how data is retrieved so this is an expected breaking change. Your solution is not the best solution since it returns all the columns. BUT it would be the quick, easy fix. I'd suggest adding in some caching on the webpart which will help performance greatly which is what we do for situations like this in v9 and newer sites.

Cloudant/Couch db pagination in search API - How to skip n number of records

I am building a typical pagination that allows the user to click on a particular page number and view the results (similar to the google search result view). I am using the cloudant search API for this. The cloudant search API provides the limit option but no skip option. How can I skip n number of results if the user is on page 1 and clicks on page 4 ?
I can see that the pagination is implemented using bookmarks. Does it mean that I need to first get the bookmark for page 4 by sending 3 additional requests one after another to the search api ?
There are a couple of different ways of handling this - one is the one you already suggested, which is just to fetch the pages as needed to get the bookmarks. I'm not sure there are many alternatives for search results where we can't pre-calculate the results.
Another alternative, and this depends a bit on the details of what you are trying to do, is to create a view containing the data and use the keys to narrow down the view to the results you need. View outputs support use of limit and skip which would enable you to implement pagination.
There's also a good example of pagination in the docs: http://docs.couchdb.org/en/2.1.0/ddocs/views/pagination.html

drupal facet api + search api: empty page (no result) default

I'm trying to create a faceted search page in Drupal 7 and it's almost done.
These are the modules I used for faceted search.
*Facet API *Search API *Database search *Search Facets *Search Views *Entity API
I created a page with views for faceted search. There are blocks for filtering etc. Here, the problem is the search page shows all results (entries) default, without filtering. If I apply some filter criteria it correctly shows the results, no problem here.
What I want is to show nothing default, an empty result area in the search page I created.
Have a look at Show facet filter even if there is no result. There's a patch available that let's you show facets on "no results found" search.
From what I understand that may be what you're looking for…
I have done the similar thing using this article.
Only difference is that i have exposed filters rather then facet filters. But this will give you idea how to do so.
Hope this will help.

Drupal Views display newest content per taxonomy limit to one node

I want to create a view where all 5 of my taxonomy terms are displayed and it then displays the latest node published but this is limited by 1. For Example:
Tax Term 1
Latest node published
Tax Term 2
Latest node published
etc etc
Currently I'm grouping by taxonomy term so it's displaying all nodes published then sorted by published date desc. I can't quite figure out how to limit the nodes to only show one item per taxonomy term.
Any help would be greatly appreciated.
This is possible with Views 3. I've tested this on D7, but should work on D6 also.
Add a new view of type - Taxonomy terms
Add relationship - Taxonomy term: Representative node
Other - Use aggregation: Yes
Add field - Content: Title. Change Aggregation settings to Group results together
It's not great if you have a lot of nodes, but I've done this in other cases by using a filter for "Promoted to front page" - then you simple make sure you only promote one node at a time.
I'd suggest to use a combination of panels ans views.
First, create a (or use the default) view for nodes which takes a taxonomy term as argument. Second, create a panels page containing five regions. Each region is to be filled with a view (in fact it's going to be the same view from step one, but with different arguments). Within panels ui you can restrict the number of shown entries of each view, set this value to one to have only one article be shown per term.
Panels: http://drupal.org/project/panels
Views: http://drupal.org/project/views
I'd recommend checking out the Views Group By module.
http://drupal.org/node/389230
The tutorial listed above actually describes almost exactly what you are trying to do.

Resources