You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/12/07 08:18:28 UTC

[GitHub] [lucene] fcofdez commented on a diff in pull request #11997: Add IntField, LongField, FloatField and DoubleField

fcofdez commented on code in PR #11997:
URL: https://github.com/apache/lucene/pull/11997#discussion_r1041891742


##########
lucene/core/src/java/org/apache/lucene/document/DoubleField.java:
##########
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.document;
+
+import org.apache.lucene.index.DocValuesType;
+import org.apache.lucene.index.PointValues;
+import org.apache.lucene.search.IndexOrDocValuesQuery;
+import org.apache.lucene.search.PointRangeQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.NumericUtils;
+
+/**
+ * Field that stores a per-document <code>double</code> value for scoring, sorting or value
+ * retrieval and index the field for fast range filters. If you also need to store the value, you
+ * should add a separate {@link StoredField} instance. If you need more fine-grained control you can
+ * use {@link DoublePoint} and {@link DoubleDocValuesField}.
+ *
+ * <p>This field defines static factory methods for creating common queries:
+ *
+ * <ul>
+ *   <li>{@link #newExactQuery(String, double)} for matching an exact 1D point.
+ *   <li>{@link #newRangeQuery(String, double, double)} for matching a 1D range.
+ * </ul>
+ *
+ * @see PointValues
+ */
+public final class DoubleField extends Field {
+  /**
+   * Creates a new DoubleField, indexing the provided point and storing it as a DocValue
+   *
+   * @param name field name
+   * @param value the double value
+   * @param sorted configure the field to support multiple DocValues
+   * @throws IllegalArgumentException if the field name or value is null.
+   */
+  public DoubleField(String name, double value, boolean sorted) {

Review Comment:
   That makes sense and I find `multivalued` less confusing than `sorted`. I used that name to be aligned with the `DocValuesType`.



-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org