Skip to content

SOLR-18329: DenseVectorField support existence queries - #4700

Merged
dsmiley merged 3 commits into
apache:mainfrom
linslee75:SOLR-18329-densevector-existence
Aug 7, 2026
Merged

SOLR-18329: DenseVectorField support existence queries#4700
dsmiley merged 3 commits into
apache:mainfrom
linslee75:SOLR-18329-densevector-existence

Conversation

@linslee75

@linslee75 linslee75 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18329

Description

DenseVectorField currently rejects existence queries with BAD_REQUEST.
Lucene has supported vector-field existence checks since 9.1 via
FieldExistsQuery, so Solr should allow the usual existence syntax on
dense vector fields.

Discuss:

Solution

  • Override DenseVectorField.getExistenceQuery() to return FieldExistsQuery
  • Treat unbounded ranges ([* TO *]) as existence queries
  • Keep rejecting bounded range queries
  • Document existence query support in the dense vector search ref guide
  • Add changelog entry

AI coding assistants were used while preparing this change.

Tests

  • Updated DenseVectorFieldTest to verify:
    • vector:*
    • -vector:*
    • vector:[* TO *]
  • Confirmed bounded range queries still return BAD_REQUEST
  • Ran:
    • ./gradlew :solr:core:test --tests org.apache.solr.schema.DenseVectorFieldTest.query_existenceSearch_shouldMatchDocumentsWithVector --tests org.apache.solr.schema.DenseVectorFieldTest.query_rangeSearch_shouldThrowException
    • ./gradlew :solr:core:check -x test

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and this code review
    sheet
  • I have created a Jira issue and added the issue ID to this pull request title
  • I have given Solr maintainers access to contribute to my PR branch
    (optional but recommended)
  • I have developed this patch against the main branch
  • I have run ./gradlew check
  • I have added tests for my changes
  • I have added documentation for the Reference Guide
  • I have added a changelog entry

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests cat:schema labels Aug 4, 2026

@dsmiley dsmiley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing!

Comment thread solr/core/src/java/org/apache/solr/schema/DenseVectorField.java Outdated
Comment thread solr/core/src/test/org/apache/solr/schema/DenseVectorFieldTest.java Outdated
@linslee75
linslee75 requested a review from dsmiley August 5, 2026 10:32
@dsmiley dsmiley added this to the 9.x milestone Aug 7, 2026
Comment thread changelog/unreleased/SOLR-18329-densevector-existence-queries.yml Outdated
@dsmiley
dsmiley merged commit 3c9fcc1 into apache:main Aug 7, 2026
1 check passed
dsmiley pushed a commit that referenced this pull request Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:schema documentation Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants