How Do You Use "where" on a Numeric Front Matter Param?

I have added a numeric param to my content’s front matter named “rating.” I want to be able to filter pages based on the rating–for example all pages where the rating is greater than 1.

Here is an example of my front mater:

title: "Hello World"
date: 2018-03-31T02:36:10-06:00
draft: false
description: ""
rating: 2

But I can’t figure our how to use this with the “where” function to filter an array. Here is an example of what I’ve tried:

{{ range where .Pages ".Params.rating" "gt" "1" }}
<p>{{ .Title }} {{ .Params.rating }} </p>
{{ end }}

This seems to return an empty array–no title are listed.

I’ve also tried this variation:

{{ range where .Pages (int .Params.rating) "gt" (int 1) }}
<p>{{ .Title }} {{ .Params.rating }} </p>
{{ end }}

…with no success.

A similar expression:

{{ range where .Pages (int .Params.rating) "ne" (int 1) }}
<p>{{ .Title }} {{ .Params.rating }} </p>
{{ end }}

…returns all pages, even those where the rating is 1.

Any suggestions?

I should note that my ultimate goal is to use the filtered array with a paginator, so simply suppressing display using {{ if (gt .Params.rating 1) )} the rating inside the range loop is not an option (but works FWIW).

As I understand it, the quotes turn the data into a string.

{{ range where .Pages ".Params.rating" "gt" 1 }}

Thanks for responding Mikhail, but your example also returns and empty array.

I just tested this code, it works without quotes, it does not work with quotes. Try restarting Hugo.

{{ range where .Pages ".Params.bibl" "gt" 400 }}
<p>{{ .Title }} {{ .Params.bibl }} </p>
{{ end }}

Also, quotes is important in the front matter, they should not be there either.

bibl: 500

Thanks for sending another example. Unfortunately it still does not work for me. As a workaround I’m not using an explicit boolean type param for filtering