The search filters when: and date: don't act the same

If you want to browse or search via date. It seems that When tag is way more restrictive than Date

This works
http://localhost:1787/tag/When/2021/4
http://localhost:1787/search?q=When%3A2021%2F4
http://localhost:1787/search?q=date%3A2021%2F04
http://localhost:1787/search?q=date%3A2021%2F04%2F17

This doesn’t work
http://localhost:1787/tag/When/2021/04
http://localhost:1787/search?q=When%3A2021%2F04
http://localhost:1787/tag/When/2021/4/17

Agreed, this is confusing.

date:, before:, and after: know to use the Asset.capturedAtLocal column.

When is searching the When tag, you’re actually hitting the fulltext index on tag names.

I could special-case “when:” search terms and normalize them to be date: terms, which would prevent the weirdness you’re seeing. I’ll try that out now.

This doesn’t work because When tag paths are not zero-padded, and I don’t do any search path normalization in that endpoint.

This would only work if you’ve changed your tagYMD setting to be ymd.

1 Like

In my opinion, you should make when searches and url parts work like date: searches so they can be used interchangeably

1 Like

I’ll get this into the next build.

1 Like

I recategorized this topic as a bug, and implemented the following in the query normalizer:

If a query term’s filter matches “when” case-insensitively, replace the filter with “date” and replace the query’s forward slashes with dashes (to make the date match ISO YYYY-MM-DD or YYYY-MM or YYYY):

export function normalizeTerm(t: Term): Term {
...
  if (toS(t.ns).toLowerCase() === "when") {
    return normalizeTerm({
      ...t,
      ns: AssetTermDateNs.date,
      term: t.term.replace(/\//g, "-")
    })
  }
...

This will be in alpha.8.

1 Like

But that only for searching? What about url parts?

I think the way PhotoStructure handled the queries you showed previously are clearly confusing, and the solution wasn’t hard, so I implemented it.

I hadn’t planned on doing /tag/path URL normalization, at least for now, because I expect people to be just clicking to navigate, not manually typing in URLs (URLs aren’t even visible in PhotoStructure for Desktops!).

If you want to suggest heuristics for this, feel free to open a new feature request and we can cook some up (like removing any padding zeros, perhaps)?

(note that this feature will need to get in line behind delete, albums, and sharing, though!)

1 Like