Skip to content

Convert Human Era to toggle with implicit API-level date filtering#10

Merged
yzqzss merged 5 commits intomainfrom
copilot/update-human-era-to-toggle
Jan 21, 2026
Merged

Convert Human Era to toggle with implicit API-level date filtering#10
yzqzss merged 5 commits intomainfrom
copilot/update-human-era-to-toggle

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

The "人类时代" (Human Era) feature previously modified the search query string and force-enabled the advanced search UI. This changes it to a toggle that applies date filtering transparently at the API call level.

Changes

  • UI: Button → Switch component with icon/label
  • Filtering: Date filter (date < sec(2023-01-01)) now injected in getSearchResults() rather than modifying query state
  • URL/Input: Remain clean - filter not visible to user
  • Advanced Search: No longer auto-activates when toggle is enabled

Implementation

Extracted filter combination logic to utility function:

// Implicitly adds filter when humanEraEnabled=true
async function getSearchResults(query: string, page: number, sort: Sort, humanEraEnabled: boolean) {
  let finalQuery = query.trim();
  if (humanEraEnabled) {
    finalQuery = addDateFilterToQuery(finalQuery, PRE_2023_DATE_FILTER);
  }
  // API call with finalQuery
}

Filter merges correctly with existing query filters using AND logic.

UI

Toggle OFF (default)
Toggle OFF

Toggle ON
Toggle ON

Result

  • User sees: /search?q=技术
  • API receives: q=技术 (date < sec(2023-01-01)) when toggle is ON
  • Advanced search UI state unchanged
Original prompt

“人类时代”做成开关而不是按钮。并且隐式在执行搜索 API 调用时插入后置的 date 过滤语句,不要向用户自动激活前端的高级搜索按钮。


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ering

Co-authored-by: yzqzss <30341059+yzqzss@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 21, 2026

Deploying neo-uglysearch with  Cloudflare Pages  Cloudflare Pages

Latest commit: ccddfeb
Status: ✅  Deploy successful!
Preview URL: https://ccb617b1.neo-uglysearch.pages.dev
Branch Preview URL: https://copilot-update-human-era-to.neo-uglysearch.pages.dev

View logs

Copilot AI and others added 2 commits January 21, 2026 01:12
Co-authored-by: yzqzss <30341059+yzqzss@users.noreply.github.com>
Co-authored-by: yzqzss <30341059+yzqzss@users.noreply.github.com>
…backslash

Co-authored-by: yzqzss <30341059+yzqzss@users.noreply.github.com>
Copilot AI changed the title [WIP] Change human era to a toggle switch Convert Human Era to toggle with implicit API-level date filtering Jan 21, 2026
Copilot AI requested a review from yzqzss January 21, 2026 01:16
@yzqzss
Copy link
Member

yzqzss commented Jan 21, 2026

AI你干得好啊AI,人类会感谢你的。

@yzqzss yzqzss marked this pull request as ready for review January 21, 2026 01:20
@yzqzss yzqzss merged commit 8d58881 into main Jan 21, 2026
5 checks passed
@OverflowCat
Copy link
Contributor

OverflowCat commented Jan 22, 2026 via email

@lawvs lawvs deleted the copilot/update-human-era-to-toggle branch January 22, 2026 08:37
@yzqzss
Copy link
Member

yzqzss commented Jan 22, 2026

@OverflowCat

本日、私「構筑番号零」言、人工知能之網頁端末使用、超基資料庫及網頁開発実施致。其強力機能圧倒、私之前端末研発者、直近失職、宅配配達従事者成事可能性有。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants