Skip to content

Prefixed search on the attendees and organizations pages - #2857

Merged
maebeale merged 6 commits into
mainfrom
maebeale/search-syntax
Oct 25, 2026
Merged

maebeale merged 6 commits into
mainfrom
maebeale/search-syntax

Conversation

@maebeale

@maebeale maebeale commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 3 Read 📖 contained: one new concern plus two pages adopting it; the people index only gains an additive URL filter

Takes the Contact info box @jmilljr24 built for the people index (#2825), generalises it into a concern, and gives it to the attendees page and the organizations index. Justin's people index search is unchanged — it only gains an additive, admin-only work_location URL filter.

Built on his pattern, not over it

  • Person keeps search_name_email and search_contact exactly as they are, and gains search_location alongside
  • searches_contact ..., as: exists precisely so a model with a search of its own can keep it
  • people/_search_boxes.html.erb has zero diff against main
  • people_controller.rb only gains lines; none of his change
  • people_search_spec.rb only gains a new describe; his examples are untouched
  • The one line removed from Person.search_by_params is the dead contact_info branch nothing reaches — every index gets there from the URL param

What the new box adds

  • Prefixes beyond his seven: locality:, district:, la_council:, la_supervisorial:, la_spa:, and type: for work/personal/mailing
  • SearchCop ANDs prefixes onto one joined address, so type: personal city: austin asks for an address that is both — one prefix instead of a parallel personal_* set
  • Live addresses only. A retired address still places someone on the charts (Address::STANDING, Chart and filter locations by where people work, on a date #2844) but shouldn't be how you look them up
  • Grammar: words AND in any order, -- means either, quotes make a phrase. amy jones--mary davis is (amy AND jones) OR (mary AND davis)

Attendees page

  • Main box becomes Name or email, borrowing Person.search_name_email whole so the same words find the same people as on the people index
  • New super-admin "Their own contact info" box (the generalised one)
  • New "Where they work" box replaces the City field — reads PersonLocations (Chart and filter locations by where people work, on a date #2844), and is what makes locality / zip / school district / LA districts filterable at all

Organizations index

  • Address box joins the shared search, keeping its LA district columns (matched as integers, outside the bare-term catch-all) and its AND semantics

People index: work_location (URL only, no box yet)

  • ?work_location=state: CA narrows the index and email export, placed by PersonLocations as of today
  • Runs after his scopes, so his query is unchanged when the param is absent
  • Admin-only (PersonPolicy::ADMIN_ONLY_FILTERS); page links carry it
  • Nothing on the page shows it's applied until the visible box lands later

Roster + bulk-email picker

  • Both now read -- as "either", the way tag filters and workshop search already do
  • Both now AND the words of an alternative, so jones amy finds Amy Jones — the roster's two CONCAT(first, ' ', last) rows only ever carried one word order

Gotcha found while testing

or is SearchCop's operator, so Oregon has to be asked for as state: OR; a bare trailing or silently matches nobody. Noted in the hint on the prefixed boxes. Pre-existing on the people index box too.

Features seed (optional)

  • Added a features seed (optional)

🤖 Generated with Claude Code

@maebeale maebeale changed the title One search grammar, and one prefixed way to ask, across every filter box Prefixed search on the attendees and organizations pages Oct 25, 2026
@maebeale
maebeale marked this pull request as ready for review October 25, 2026 18:08
@maebeale
maebeale force-pushed the maebeale/work-location-charts branch from 8c462c8 to 1f62ddc Compare October 25, 2026 18:18
@maebeale
maebeale force-pushed the maebeale/search-syntax branch from 2048cf8 to 1730746 Compare October 25, 2026 18:18
Base automatically changed from maebeale/work-location-charts to main October 25, 2026 18:50
@maebeale
maebeale force-pushed the maebeale/search-syntax branch from 1730746 to f3d6db1 Compare October 25, 2026 18:53
maebeale and others added 6 commits October 25, 2026 14:54
Four search boxes had grown four dialects. The people index took SearchCop's
`or`; the roster keyword box took neither `or` nor the `--` that means "either"
in every tag filter, workshop search and picker in this app; and typing a second
word widened the people index while narrowing nothing anywhere else. Now the
words inside an alternative all have to match in any order, `--` keeps either,
quotes make a phrase, and one generated hint sits beside every box saying so.
The two rules combine, which is the whole reason expand_alternatives
parenthesises each alternative before SearchCop sees it.

ContactSearchable holds the prefix map once, so the people index, the attendees
page and the organizations index offer the same words and a prefix added here
reaches all three. `type:` narrows to a work or personal address and, because
SearchCop ANDs prefixes onto one joined row, `type: personal city: austin` asks
for an address that is both — one prefix instead of a parallel personal_* set,
composing with every field. The organizations box keeps its LA district columns
by sitting them beside `type:` out of the bare-term catch-all, where they can be
matched as the integers they are.

Searching reads live addresses only. The standing chain settles which address
SHOWS a person; it is the wrong rule for finding them, because an admin holding
their old address would search it and be told nobody lives there.

The attendees page had two City filters meaning different things side by side.
The work-location one becomes a prefixed box of its own, "Where they work",
which is also what lets locality, zip, school district and the LA districts be
filtered at all. A visible dropdown still wins over the same field typed into
the box, and a bare city param stays honoured as a chip so an older link narrows
visibly rather than silently.

Person.search_by_params no longer answers contact_info: every index reaches
ContactSearchable from the URL param directly, so the branch was a second, older
meaning for the same word.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The last pass generalised the people index's Contact info box by rewriting it:
its scopes moved into the concern, its grammar changed from "either" to "all",
and its hint became a generated constant. That is someone else's page, shipped
this week, and nothing here needed it to change.

Person keeps search_name_email and search_contact exactly as the people index
has always had them, and gains search_location alongside — the same idea with
the wider prefix set, the shared grammar and live addresses only. `as:` on
searches_contact exists so a model that already has a search of its own can keep
it. The controller, the view and the request specs are byte-identical to main
again; the one line still gone from search_by_params is the dead contact_info
branch nothing reaches.

The specs for `type:`, for retired addresses and for the AND/OR grammar moved to
the attendees page, which is where that behaviour now lives. Writing them turned
up that a bare trailing `or` is SearchCop's operator, so Oregon has to be asked
for as `state: OR` — said in the hint on the boxes that take prefixes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PersonLocations reads where someone works from their active affiliations, so a
work address hung off the registration no longer places anyone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The attendees page's Where they work query now reaches the people index and its
email export through a work_location param, placed by PersonLocations as of
today. It runs after the existing name/email and contact scopes, so the people
index query is unchanged whenever the param is absent; the visible box comes in
a later step. Admin-only, like contact_info.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@maebeale
maebeale force-pushed the maebeale/search-syntax branch from f3d6db1 to fe1afed Compare October 25, 2026 18:55
@maebeale
maebeale merged commit 8de6967 into main Oct 25, 2026
3 checks passed
@maebeale
maebeale deleted the maebeale/search-syntax branch October 25, 2026 19:08
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.

1 participant