sstults opened a new pull request, #5321: URL: https://github.com/apache/solr/pull/5321
https://issues.apache.org/jira/browse/SOLR-3191 # Description Adds field exclusions to `fl`: `fl=-title` returns every field except `title`, and `fl=*,-attr_*` returns every field except those matching `attr_*`. This is a rework of my earlier patch for apache/lucene-solr#271, taking up dsmiley's request there to bring it to `main`. The original patch rewrote the `fl` parser in `SolrReturnFields`. The parser on `main` has changed enough that this is no longer needed, so this PR has no refactoring in it. The `fl` section of the Ref Guide documents the new syntax. # Solution `SolrReturnFields` parses a leading `-` followed by a field name or glob as an exclusion. An exclusion list with no inclusions is treated as `*` plus the exclusions. That case is converted to a `*` glob, so the response writers, `SolrDocumentFetcher` and the export writer, which already handle globs, need no changes. - Exclusions subtract only from `*` and glob matches. A field named explicitly is still returned. - When `fl` has explicit fields but no glob, exclusions have no effect, as in the original patch. - A leading `-` that is not a field name or glob, such as `-1`, is still parsed as a function. I used Claude Code to port the patch to the current parser, to write the tests and to write the Ref Guide text. I reviewed and ran the result. # Tests Added `ReturnFieldsTest.testExclusions`, covering: - exclusion alone - `*` with literal and glob exclusions - hyphenated field names - exclusions alongside explicit fields and globs - pseudo-fields (`score`) - a leading `-` parsed as a function `./gradlew check` passes. I also built the Ref Guide locally (`buildLocalAntoraSite`) and checked the rendered `fl` section, which is how I found and fixed `*` characters being read as bold markup. # Checklist - [x] I have reviewed the guidelines for [How to Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my code conforms to the standards described there to the best of my ability. - [x] I have created a Jira issue and added the issue ID to my pull request title. - [x] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. - [x] I have developed this patch against the `main` branch. - [x] I have run `./gradlew check`. - [x] I have added a [changelog entry](https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc) for my change -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
