What happened?
Description
When working with site('*') and unique() in a search query, the output contains more or less entries compared to the limit I set – with more than enough entries to limit.
- I get 10 entries without
site('*') and unique().
- I get 6 entries without
site('*') and with unique().
- I get 12 entries with
site('*') and without unique().
{% set searchTerm = q ?? null %}
{% set searchQuery = craft.entries()
.section([
'home',
'locations',
'news',
'pages',
'persons',
])
.orderBy('score, title ASC')
.limit(10)
.search(searchTerm)
.site('*')
.unique()
%}
Steps to reproduce
- Create a couple of entries
- Create a search query similar to the example above, using a reasonable
limit value
- Output the
length of the search results with and without site('*') and unique()
Expected behavior
The limit parameter should always limit the query to the exact limit value.
Actual behavior
The query output is not being limited based on the limit value.
Craft CMS version
5.5.2
PHP version
8.3
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
What happened?
Description
When working with
site('*')andunique()in a search query, the output contains more or less entries compared to thelimitI set – with more than enough entries to limit.site('*')andunique().site('*')and withunique().site('*')and withoutunique().{% set searchTerm = q ?? null %} {% set searchQuery = craft.entries() .section([ 'home', 'locations', 'news', 'pages', 'persons', ]) .orderBy('score, title ASC') .limit(10) .search(searchTerm) .site('*') .unique() %}Steps to reproduce
limitvaluelengthof the search results with and withoutsite('*')andunique()Expected behavior
The
limitparameter should always limit the query to the exactlimitvalue.Actual behavior
The query output is not being limited based on the
limitvalue.Craft CMS version
5.5.2
PHP version
8.3
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions