You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2021/07/29 17:12:38 UTC

[lucene] 01/06: Category documents added in the Lucene 9.0 taxonomy index use a BDV field with a different name

This is an automated email from the ASF dual-hosted git repository.

mikemccand pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit 7cb696041c30474ae16e90d5209eb9f342da1149
Author: Gautam Worah <ga...@amazon.com>
AuthorDate: Wed Jul 21 01:08:53 2021 -0700

    Category documents added in the Lucene 9.0 taxonomy index use a
    BDV field with a different name
    
    Using BDV fields with a different "$full_path_binary$" name
    ensures that the earlier "$full_path$" StringField does not have the same name as the
    BDV field and hence they don't violate the field type consistency check
    (LUCENE-9334).
    
    This commit also enables the back-compat check that was disabled
    earlier.
---
 .../src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java     | 1 +
 .../apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java | 2 +-
 .../apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java | 2 +-
 .../lucene/facet/taxonomy/directory/TestBackwardsCompatibility.java     | 1 -
 4 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java
index 104bfdf..5bc253f 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java
@@ -21,6 +21,7 @@ import org.apache.lucene.util.BytesRef;
 /** @lucene.experimental */
 abstract class Consts {
   static final String FULL = "$full_path$";
+  static final String FULL_BINARY = "$full_path_binary$";
   static final String FIELD_PAYLOADS = "$payloads$";
   static final String PAYLOAD_PARENT = "p";
   static final BytesRef PAYLOAD_PARENT_BYTES_REF = new BytesRef(PAYLOAD_PARENT);
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java
index ea38d8c..71d3481 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java
@@ -335,7 +335,7 @@ public class DirectoryTaxonomyReader extends TaxonomyReader implements Accountab
     int readerIndex = ReaderUtil.subIndex(ordinal, indexReader.leaves());
     LeafReader leafReader = indexReader.leaves().get(readerIndex).reader();
     // TODO: Use LUCENE-9476 to get the bulk lookup API for extracting BinaryDocValues
-    BinaryDocValues values = leafReader.getBinaryDocValues(Consts.FULL);
+    BinaryDocValues values = leafReader.getBinaryDocValues(Consts.FULL_BINARY);
 
     FacetLabel ret;
 
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
index ad0c74c..53445b1 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
@@ -476,7 +476,7 @@ public class DirectoryTaxonomyWriter implements TaxonomyWriter {
     String fieldPath = FacetsConfig.pathToString(categoryPath.components, categoryPath.length);
     fullPathField.setStringValue(fieldPath);
     d.add(fullPathField);
-    d.add(new BinaryDocValuesField(Consts.FULL, new BytesRef(fieldPath)));
+    d.add(new BinaryDocValuesField(Consts.FULL_BINARY, new BytesRef(fieldPath)));
 
     // Note that we do no pass an Analyzer here because the fields that are
     // added to the Document are untokenized or contains their own TokenStream.
diff --git a/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestBackwardsCompatibility.java b/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestBackwardsCompatibility.java
index 05142b8..76138bd 100644
--- a/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestBackwardsCompatibility.java
+++ b/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestBackwardsCompatibility.java
@@ -55,7 +55,6 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
   // Old taxonomy index had $full_path$ field indexed only with postings,
   // It is not allowed to add the same field $full_path$ indexed with BinaryDocValues
   // for a new segment, that this test is trying to do.
-  @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/LUCENE-9334")
   public void testCreateNewTaxonomy() throws IOException {
     createNewTaxonomyIndex(oldTaxonomyIndexName);
   }