Commit 7496138
Allow multiple intermediate fields in number field search (LMFDB#6827)
The "Intermediate field" search box now accepts a comma-separated list of
subfields (polynomials, field labels, or nicknames, freely mixed). The search
returns number fields containing every listed subfield, i.e. the AND of the
containment conditions (equivalently, fields containing their compositum).
This makes it easy to search for e.g. Q(sqrt2, sqrt3, sqrt5) without first
computing a defining polynomial for the compositum.
parse_subfield splits the input on commas and parses each piece with the
existing input_to_subfield helper, emitting {"$contains": [...]} on the
text[] subfields column. This compiles to a single "subfields @> ARRAY[...]"
Postgres containment test (no per-row recomputation) -- the same operator the
single-subfield search already used, so single-field behavior is unchanged.
Whitespace is stripped by the search parser, so "x^2-2, x^2-3" works too. A
malformed entry raises the existing clean SearchParsingError. Help text and a
test were added.
Verified with the flask test client: single label/polynomial (unchanged),
multiple polynomials and multiple labels both returning the compositum, three
quadratics correctly excluding the degree-4 field, and malformed input giving
a flashed error rather than a 500.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 5ef81bd commit 7496138
3 files changed
Lines changed: 26 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1316 | 1316 | | |
1317 | 1317 | | |
1318 | 1318 | | |
1319 | | - | |
| 1319 | + | |
| 1320 | + | |
1320 | 1321 | | |
1321 | 1322 | | |
1322 | 1323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
49 | 61 | | |
50 | 62 | | |
51 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1615 | 1615 | | |
1616 | 1616 | | |
1617 | 1617 | | |
1618 | | - | |
1619 | | - | |
1620 | | - | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
1621 | 1630 | | |
1622 | 1631 | | |
1623 | 1632 | | |
| |||
0 commit comments