Allow group names in abstract-group label search boxes (LMFDB#6397) - #39
Allow group names in abstract-group label search boxes (LMFDB#6397)#39roed-math wants to merge 3 commits into
Conversation
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>
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>
|
Pushed The bug. Both new parsers tokenized with The fix (
Tests (
Verification. |
|
GPT signed off. |
|
Superseded by LMFDB#7173, opened upstream from this same branch. Closing here; review continues upstream. |
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 likeC_2^3orC_2\times C_4. Names are resolved to labels by a newname_to_labelhelper 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 asSO+(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