mirror of https://github.com/apache/lucene.git
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.
This commit is contained in:
parent
ba417b593f
commit
7cb696041c
|
@ -21,6 +21,7 @@ import org.apache.lucene.util.BytesRef;
|
||||||
/** @lucene.experimental */
|
/** @lucene.experimental */
|
||||||
abstract class Consts {
|
abstract class Consts {
|
||||||
static final String FULL = "$full_path$";
|
static final String FULL = "$full_path$";
|
||||||
|
static final String FULL_BINARY = "$full_path_binary$";
|
||||||
static final String FIELD_PAYLOADS = "$payloads$";
|
static final String FIELD_PAYLOADS = "$payloads$";
|
||||||
static final String PAYLOAD_PARENT = "p";
|
static final String PAYLOAD_PARENT = "p";
|
||||||
static final BytesRef PAYLOAD_PARENT_BYTES_REF = new BytesRef(PAYLOAD_PARENT);
|
static final BytesRef PAYLOAD_PARENT_BYTES_REF = new BytesRef(PAYLOAD_PARENT);
|
||||||
|
|
|
@ -335,7 +335,7 @@ public class DirectoryTaxonomyReader extends TaxonomyReader implements Accountab
|
||||||
int readerIndex = ReaderUtil.subIndex(ordinal, indexReader.leaves());
|
int readerIndex = ReaderUtil.subIndex(ordinal, indexReader.leaves());
|
||||||
LeafReader leafReader = indexReader.leaves().get(readerIndex).reader();
|
LeafReader leafReader = indexReader.leaves().get(readerIndex).reader();
|
||||||
// TODO: Use LUCENE-9476 to get the bulk lookup API for extracting BinaryDocValues
|
// 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;
|
FacetLabel ret;
|
||||||
|
|
||||||
|
|
|
@ -476,7 +476,7 @@ public class DirectoryTaxonomyWriter implements TaxonomyWriter {
|
||||||
String fieldPath = FacetsConfig.pathToString(categoryPath.components, categoryPath.length);
|
String fieldPath = FacetsConfig.pathToString(categoryPath.components, categoryPath.length);
|
||||||
fullPathField.setStringValue(fieldPath);
|
fullPathField.setStringValue(fieldPath);
|
||||||
d.add(fullPathField);
|
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
|
// 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.
|
// added to the Document are untokenized or contains their own TokenStream.
|
||||||
|
|
|
@ -55,7 +55,6 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
||||||
// Old taxonomy index had $full_path$ field indexed only with postings,
|
// 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
|
// 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.
|
// 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 {
|
public void testCreateNewTaxonomy() throws IOException {
|
||||||
createNewTaxonomyIndex(oldTaxonomyIndexName);
|
createNewTaxonomyIndex(oldTaxonomyIndexName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue