Skip to content

fix(schema): describe list-fields flags by the names it returns - #301

Open
adityamparikh wants to merge 1 commit into
apache:mainfrom
adityamparikh:fix/list-fields-flag-names
Open

adityamparikh wants to merge 1 commit into
apache:mainfrom
adityamparikh:fix/list-fields-flag-names

Conversation

@adityamparikh

Copy link
Copy Markdown
Contributor

Summary

The search-collection prompt and search's "Solr rejected the request" hint describe list-fields output in Luke's raw form. list-fields (#288) now returns flags as SolrJ FieldFlag names and sends neither schema letters nor info, so a model following the prompt found no D on any field and could conclude that nothing can be faceted or sorted.

 1. Learn the fields.
    - Call `list-fields` on `%s`. ...
-     (`string`/`strings`), and which are numeric/date ranges. A `D` in a field's
-     `schema` flags (decoded by `info.key`) means docValues: those are the fields you
-     can facet on, and sort on when they are single-valued (no `M`). `dynamicBase`
-     shows which pattern a field came from (e.g. `*_s`).
+     (`string`/`strings`), and which are numeric/date ranges. Fields whose `flags`
+     include `DOC_VALUES` are the ones you can facet on; you can sort on them when
+     `flags` does not also include `MULTI_VALUED`. `dynamicBase` shows which pattern a
+     field came from (e.g. `*_s`). A missing or 0 `docs` on a numeric, date or
+     docValues-only field means Solr could not count it, not that it is empty.

The hint now matches the list-fields tool description: facet on DOC_VALUES fields, and sort only on ones that are not also MULTI_VALUED. It used to say faceting also needs a single-valued field, which is wrong. The view-schema prompt's pointer to list-fields adds the same docs caveat.

Evidence

  • Before: list-fields on a collection returns, for seasons (stored in all 61 documents):

    "seasons": {"type": "pint", "flags": ["INDEXED","STORED","DOC_VALUES","OMIT_NORMS","OMIT_TF"], "docs": 0}

    There is no schema key, no info.key and no D/M, which is what the prompt told the model to look for. docs: 0 reads as "empty".

    After: SearchServiceTest.searchGuidance_namesTheFlagsListFieldsReturns checks that both the prompt and the hint name FieldFlag.DOC_VALUES and FieldFlag.MULTI_VALUED, the names FieldFlags.NameSerializer writes, and mention neither info.key nor "schema flags". SchemaServiceTest.viewSchemaPrompt_saysUncountedFieldsAreNotEmpty covers the docs caveat. ./gradlew build passes (480 tests).

Merge Danger

Door: two-way

Prompt and error-hint text only.

Blast Radius: prompt

🤖 Generated with Claude Code

The search-collection prompt and search's "Solr rejected the request"
hint told the model to look for a `D` in a field's `schema` flags,
decoded by `info.key`, and to treat a field without `M` as single-valued.
That is Luke's raw output. list-fields now returns `flags` as SolrJ
FieldFlag names (DOC_VALUES, MULTI_VALUED, ...) and sends neither
`schema` letters nor `info`, so a model following the prompt found no
`D` on any field. Both now name DOC_VALUES and MULTI_VALUED, and the hint
no longer says faceting needs a single-valued field.

The search-collection and view-schema prompts also say that a missing or
0 `docs` on a numeric, date or docValues-only field means Solr could not
count it, not that the field is empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

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