jimczi commented on code in PR #14034:
URL: https://github.com/apache/lucene/pull/14034#discussion_r1868112911


##########
lucene/core/src/java/org/apache/lucene/document/FeatureField.java:
##########
@@ -123,10 +123,33 @@ public final class FeatureField extends Field {
    * @param featureValue The value of the feature, must be a positive, finite, 
normal float.
    */
   public FeatureField(String fieldName, String featureName, float 
featureValue) {
-    super(fieldName, featureName, FIELD_TYPE);
+    this(fieldName, featureName, featureValue, false);
+  }
+
+  /**
+   * Create a feature.
+   *
+   * @param fieldName The name of the field to store the information into. All 
features may be
+   *     stored in the same field.
+   * @param featureName The name of the feature, eg. 'pagerank`. It will be 
indexed as a term.
+   * @param featureValue The value of the feature, must be a positive, finite, 
normal float.
+   * @param storeTermVectors Whether term vectors should be stored.
+   */
+  public FeatureField(
+      String fieldName, String featureName, float featureValue, boolean 
storeTermVectors) {
+    super(fieldName, featureName, toFieldType(storeTermVectors));
     setFeatureValue(featureValue);
   }
 
+  private static FieldType toFieldType(boolean storeTermVectors) {
+    if (storeTermVectors) {
+      var ft = new FieldType(FIELD_TYPE);
+      ft.setStoreTermVectors(true);
+      return ft;

Review Comment:
   I pushed 
https://github.com/apache/lucene/pull/14034/commits/8fc35f889e79db38419a576548e427ad3317a99a



-- 
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

Reply via email to