processwire-requests
processwire-requests copied to clipboard
Add PageFinder support for finding pages and sorting pages by field value length
Short description of the enhancement
It would be nice enhancement to PageFinder selectors if we could match pages by the length of a field value, or sort by the length of a field value.
Example:
// Find pages whose title length is greater than 10 characters
$items = $pages->find("title.length>10");
There was a question about this in the forum: https://processwire.com/talk/topic/26372-search-by-the-number-of-characters-in-the-title-of-the-page-with-selector/
And I remember a situation in the past where I would have liked to sort results by the length of the path (when PagePaths is installed):
$longest_path = $pages->get("foo=bar, sort=-path.length");
@ryancramerdesign - I would also love to see this feature - being able to filter by length would be an excellent performance boost. Currently I have to loop through thousands of results and continue
if the min length isn't met for a specific field.
Thanks for considering.
@adrianbj check out this forum thread with two possible workarounds: https://processwire.com/talk/topic/29279-selectsort-by-text-length/