Skip to content

Allow group names in abstract-group label search boxes (LMFDB#6397) - #39

Closed
roed-math wants to merge 3 commits into
mainfrom
ai/t36-group-name-search
Closed

Allow group names in abstract-group label search boxes (LMFDB#6397)#39
roed-math wants to merge 3 commits into
mainfrom
ai/t36-group-name-search

Conversation

@roed-math

@roed-math roed-math commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Search boxes in the abstract groups section that take group labels (center, commutator, central quotient, abelianization, automorphism group, outer automorphism group, Frattini subgroup; subgroup/ambient/quotient in the subgroup search; group/image in the complex character search) now also accept group names, e.g. C6, S4, D8, Q8, C2^3, C2xC4, SL(2,7), GL(2,3), 8T3, and light TeX variants like C_2^3 or C_2\times C_4. Names are resolved to labels by a new name_to_label helper that reuses the jump box's resolution paths (stored names, cyclic products via primary invariants, special family names, transitive labels), so a name works in a search box iff it works in the jump box. Comma-separated lists may mix labels, names, and (where previously allowed) orders; only top-level commas split the list, so a family name whose parameters contain a comma stays in one piece, and unbalanced delimiters or empty entries give the section's search-input error. A + inside a name such as SO+(4,2) is preserved, while a leading unary + on an order or label is still accepted. Unknown or ambiguous names produce a search-input error naming the offending entry. Adds tests pairing each name search with the existing sibling label test so the two stay in sync. Addresses LMFDB#6397.

🤖 Generated with Claude Code

Group-label search boxes in the abstract groups section (center,
commutator, central quotient, abelianization, aut/outer group, Frattini;
subgroup/ambient/quotient; character group/image) now accept group names
such as C6, S4, D8, Q8, C2^3, C2xC4, SL(2,7), GL(2,3), 8T3 and TeX-ish
variants, resolved to labels by a new name_to_label helper reusing the
jump-box resolution paths (stored names, cyclic products, special family
names, transitive labels).  Unknown or ambiguous names give a search
input error naming the offending entry.

Verified with sage -python parser-level checks (name queries identical
to label queries) and flask test client via pytest (new tests
test_search_by_name, test_search_by_name_subgroups,
test_search_by_bad_name plus sibling label tests: 14 passed); pyflakes
clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
roed314 and others added 2 commits August 4, 2026 17:23
Both parsers added by the previous commit tokenized their input with
inp.split(","), so a family name whose parameters contain a comma, such
as SL(2,7) or GL(2,3), was chopped into SL(2 and 7) and never reached
name_to_label -- exactly the names the search boxes advertise.

split_group_search_terms now splits only at commas outside (), [] and {},
and raises SearchParsingError for unbalanced delimiters or empty entries
so that they give the section's normal search input error rather than a
complaint about a truncated name.  Both parse_group_label_or_order_or_name
and parse_group_label_or_name use it.  (split_top_level_commas in
search_wrapper.py is deliberately lenient for jump boxes, so it is not
reused here.)

parse_group_label_or_order_or_name also dropped prep_plus=True, which
deletes every + in the input; that was harmless for labels and orders,
but it mangles the stored name SO+(4,2) (= 72.40) now that names are
accepted.  A leading unary + is instead stripped from each entry, so +8
and +8.3 keep working while an internal + is preserved.

Tested with sage -python -m pytest lmfdb/groups/: the three affected
tests (test_search_by_name_with_commas, test_search_by_name_with_plus,
test_search_by_bad_name) fail on 6bcfa82 and pass here; pyflakes clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@roed-math

Copy link
Copy Markdown
Owner Author

Pushed 4f231530a, which fixes the comma-splitting bug found in review.

The bug. Both new parsers tokenized with inp.split(","), so a family name whose parameters contain a comma was chopped up before resolution: SL(2,7) became SL(2 and 7) and never reached name_to_label. Every name the description advertises with parameters (SL(2,7), GL(2,3), ...) was broken, and none of the new tests exercised one. Separately, parse_group_label_or_order_or_name kept prep_plus=True, which deletes every + in the input; that was harmless when the box took only labels and orders, but it mangles the stored name SO+(4,2) (= 72.40) now that names are accepted.

The fix (lmfdb/groups/abstract/main.py):

  • split_group_search_terms splits only at commas outside (), [] and {}, and raises SearchParsingError for unbalanced delimiters or empty entries (C2,,C3, trailing comma) so those land on the section's normal search-input error page instead of being reported as a truncated name. Both parse_group_label_or_order_or_name and parse_group_label_or_name use it, so the complete name is preserved before resolution rather than being patched up inside name_to_label. split_top_level_commas in search_wrapper.py is deliberately lenient (it hands unbalanced input on to the jump logic), so it isn't reused here.
  • prep_plus=True is replaced by strip_unary_plus, applied per entry: +8 and +8.3 keep working, and an internal + reaches name_to_label unchanged.

Tests (lmfdb/groups/abstract/test_browse_page.py) — three tests, all of which fail on 6bcfa82a8 and pass on 4f231530a:

  • test_search_by_name_with_commasaut_group=GL(2,3) (label-only box), commutator_label=SL(2,7) (order-or-name box), ambient=SL(2,7) in the subgroup search, the mixed list aut_group=GL(2,3),C6, and an order mixed with a comma-bearing name, commutator_label=8,SL(2,7)&order=336336.114 (from the name) plus 336.169/336.170/336.213 (from the order).
  • test_search_by_name_with_pluscentral_quotient=SO%2B(4%2C2)&order=144144.115, 144.186; center_label=%2B8 and center_label=%2B8.1 still behave as before.
  • test_search_by_bad_name — extended so that unbalanced SL(2,7 gives the right error title in all three searches and does not report the truncated SL(2, and C2,,C6 is rejected.

Verification. sage -python -m pytest lmfdb/groups/ → 83 passed against devmirror; the three tests above → 3 failed on the previous head, pass here; pyflakes clean. Full CI is running on the push.

@roed314

roed314 commented Aug 5, 2026

Copy link
Copy Markdown

GPT signed off.

@roed-math

Copy link
Copy Markdown
Owner Author

Superseded by LMFDB#7173, opened upstream from this same branch. Closing here; review continues upstream.

@roed-math roed-math closed this Aug 6, 2026
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.

2 participants