Repository navigation
Limit search queries to the search fields and stop indexing comment email addresses - #225
Conversation
…mail addresses Queries that name another index field are a parse error. Indexes built by earlier versions still hold the email field; the query check covers them, and a rebuild drops the field.
|
🤖 GLM: PR-Review — General Issues The following issues were found but cannot be attached to a specific line in the diff:
Strengths (not action items): overriding the full set of parser hooks (field/fuzzy/prefix/wildcard/regexp/range, both getFieldQuery signatures) closes the bypass shapes, not just the plain prefix form, and the tests enumerate exactly those shapes. |
|
🤖Claude: fixed by adding a CHANGES.md entry under 6.1.7 behaviour changes, including a note to rebuild the search index (e24deaf). |
mraible
left a comment
There was a problem hiding this comment.
I checked the field check against about 20 query forms: quoted, grouped, boosted, prefixed with +/-, ranges, wildcards and mixed case. Nothing gets around it, and plain, title and comment queries still parse. LGTM, with one small, non-blocking note inline.
snoopdave
left a comment
There was a problem hiding this comment.
The fix is right. Some ways to make it harder to break, inline, plus:
usernameis still indexed and stored (IndexOperation.getDocument, theFieldConstants.USERNAMEfield). Nothing outsideIndexOperationreads it: not for filtering, sorting or display. Same asc_name(inline). Dropping both means the index holds only what search needs, and the parser check becomes a second line of defense.- No test that the document no longer holds
c_email. A test onIndexOperation.getDocumentthat checks the field is gone (andusernameandc_name, if dropped) would keep it from coming back.
…the index SearchFieldsQueryParser now walks the parsed query with a QueryVisitor instead of overriding each query builder. The index no longer holds author user names or comment author names. At startup, an index that still holds a removed field is deleted and rebuilt in the background.
…-fields # Conflicts: # CHANGES.md
…-fields # Conflicts: # CHANGES.md
Weblog search changes:
username:…, is treated like any other query that cannot be parsed.Tests:
SearchFieldsQueryParserTest(new) and a new check inIndexManagerTest. Full build and tests pass on JDK 11.This PR and the search-results PR both add a few lines to
IndexManagerTest; whichever merges second needs a trivial rebase.