jpountz commented on a change in pull request #767: URL: https://github.com/apache/lucene/pull/767#discussion_r839380353
########## 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: Lucene 9 introduced a new index-time requirement that a field always uses the same data structures. Ie. if a document has both points and doc values for a field, then all other documents need to either have neither points and doc values for the field, or both points and doc values. It makes it legal to do this sort of optimization. https://issues.apache.org/jira/browse/LUCENE-9334 -- 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