Since the behavior of filterConstraints is extremely vague in the XenForo documentation:
Allow type-specific pre-constraint application filtering. For example, a "thread only" constraint may change the searchable content types.
This makes it seem like filterConstraints is used in a scope where input-constraints are not yet available (which would be earlier than the input, suggesting the input will be appended to the same $constraints and that all will appear in the URL).
Additionally, filterConstraints is never actually used in default XenForo in a way that would suggest that it is the "correct" method of applying constraint default-values vs getTypeConstraintsFromInput when the constraint is omitted from input or otherwise invalid or that would provide a noticeable example of how it affects the results-URL.
For this report, the code in question only runs under Advanced Search of Wiki Pages, which in normal operation includes this constraint in the form and actually passes as input, so this report is treated as an improvement request rather than a bug. Even though the result of an unmodified wiki-pages advanced search is an ugly results URL, again, XenForo did not document that filterConstraints would keep default constraint values out of the URL, so this is an improvement rather than a bug.
As such, the severity of this is very minor, and this will be fixed in the next release rather than a new build.
In
library/vw/XenForo/Search/DataHandler/Base.php, find:
Code:
$areaids = vw_Hard_Core::model('Search')->conform_areachoice($ctrl->get_value('areachoice'), !empty($params['children']));
Replace with:
Code:
if (!empty($do_children))
{
$constraints['area_children'] = true;
}
$areaids = $ctrl->get_value('areachoice');
if ($areaids)
{
$constraints['areaid'] = $areaids;
}
Find:
Code:
public function processConstraint(XenForo_Search_SourceHandler_Abstract $sourceHandler, $constraint, $constraintInfo, array $constraints)
Before it, add:
Code:
public function filterConstraints(XenForo_Search_SourceHandler_Abstract $sourceHandler, array $constraints)
{
if (!isset($constraints['areaid']))
{
$constraints['areaid'] = array();
}
$constraints['areaid'] = vw_Hard_Core::model('Search')->conform_areachoice($constraints['areaid'], !empty($constraints['area_children']));
return $constraints;
}