feat(content-search): add date range filters for date/datetime fields#35745
feat(content-search): add date range filters for date/datetime fields#35745dsilvam wants to merge 3 commits into
Conversation
When a content type is selected in the Content Search portlet, date and date_time fields now render as FROM–TO date picker pairs instead of free-text Lucene syntax inputs. Each picker pair builds a Lucene range value ([YYYYMMDD000000 TO YYYYMMDD235959]) and stores it in the existing hidden field consumed by ContentletAjax. clearSearch() resets the pickers. No backend changes required. Closes #33724 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @dsilvam's task in 3m 38s —— View job Claude PR Review
Findings1. (Bug) Initial-state inconsistency on saved search restoration — When var result = "<input type=\"hidden\" id=\"" + fieldId + "\" name=\"" + ... + "\" value=\"\" />"If the user clicks Search without touching either picker (e.g. on session restore or after switching tabs/content types), the UI shows a date range but the hidden field is empty, so the filter is silently dropped. The pickers do not fire 2. (Robustness) var parts = mmddyyyy.split('/');
if (parts.length !== 3 || parts[2].length !== 4) return null;Length checks only. Input like 3. (Minor regression) Tooltip fallback fell through to Original: if (type=='date') hintLabel = date.hint;
if (type=='date_time') hintLabel = datetime.hint;
else if (type=='time') hintLabel = time.hint;New: date/date_time return early, all other types (any field whose 4. (UX) Double
5. (Compat) Legacy single-value date searches won't restore Any saved search whose date field stored a plain Looks fine
|
- Replace invalid sentinel dates 00000000000000/99999999999999 with 18000101000000/30000101000000 to match the existing convention in ContentletAjax.java - Wrap promptMessage i18n values with UtilMethods.escapeSingleQuotes() to prevent attribute injection from localized translations - Move date-from/date-to keys to alphabetical position near other date-* entries in Language.properties Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Validate 14-digit format in luceneDateToMmddyyyy with /^\d{14}$/ regex,
blocking XSS injection via malformed persisted range values
- Add value.endsWith(']') guard to prevent silent mis-parse when the
closing bracket is missing from a stored range value
- Add comments on sentinel bounds (18000101/30000101) to document why
they match ContentletAjax convention
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
dijit.form.DateTextBox) for eachdateanddate_timefield in the selected content type[YYYYMMDD000000 TO YYYYMMDD235959]) stored in the existing hidden field consumed byContentletAjax— no backend changes requiredclearSearch()now resets the date pickers alongside other fields?Lucene-syntax tooltip from date/date_time dynamic fields since the pickers make it redundantdate-from/date-toi18n keys toLanguage.propertiesTest plan
dateordate_timefields marked as Searchable + IndexedmodDate ≥ FROMmodDate ≤ TOCloses #33724
🤖 Generated with Claude Code