zacharymorn commented on a change in pull request #767: URL: https://github.com/apache/lucene/pull/767#discussion_r840249824
########## File path: lucene/core/src/java/org/apache/lucene/search/DocValuesFieldExistsQuery.java ########## @@ -31,42 +28,21 @@ /** * A {@link Query} that matches documents that have a value for a given field as reported by doc * values iterators. + * + * @deprecated Use {@link org.apache.lucene.search.FieldExistsQuery} instead. */ -public final class DocValuesFieldExistsQuery extends Query { - - private final String field; +@Deprecated +public final class DocValuesFieldExistsQuery extends FieldExistsQuery { + private String field; /** Create a query that will match documents which have a value for the given {@code field}. */ public DocValuesFieldExistsQuery(String field) { + super(field); this.field = Objects.requireNonNull(field); } - public String getField() { - return field; - } - - @Override - public boolean equals(Object other) { - return sameClassAs(other) && field.equals(((DocValuesFieldExistsQuery) other).field); - } - - @Override - public int hashCode() { - return 31 * classHash() + field.hashCode(); - } - - @Override - public String toString(String field) { - return "DocValuesFieldExistsQuery [field=" + this.field + "]"; - } - - @Override - public void visit(QueryVisitor visitor) { - if (visitor.acceptField(field)) { - visitor.visitLeaf(this); - } - } - + // nocommit this seems to be generalizable to norms and knn as well given LUCENE-9334, and thus + // could be moved to the new FieldExistsQuery? Review comment: Thanks @jpountz for the clarification! I guess to put my question differently, this current implementation doesn't seems to cover the case where the docs only have `DocValues`, but not `PointValues` fields, as asserted in this existing test case: https://github.com/apache/lucene/blob/69b040fc6292ac47d7f7fc8bc3b7fd601794e54b/lucene/core/src/test/org/apache/lucene/search/TestDocValuesFieldExistsQuery.java#L103-L126 I would imagine in this scenario `DocValuesFieldExistsQuery` should be overwritten to `MatchAllDocsQuery`, since all docs that doc values field and value? -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org