Skip to content

Commit

Permalink
revert auto-complete field combining at index time
Browse files Browse the repository at this point in the history
  • Loading branch information
alecgrieser committed May 19, 2022
1 parent 86b82ce commit fb8d0db
Showing 1 changed file with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import com.apple.foundationdb.record.provider.foundationdb.indexes.StandardIndexMaintainer;
import com.apple.foundationdb.record.query.QueryToKeyMatcher;
import com.apple.foundationdb.tuple.Tuple;
import com.google.common.base.Joiner;
import com.google.protobuf.Message;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
Expand Down Expand Up @@ -227,15 +226,6 @@ private void writeDocument(@Nonnull List<LuceneDocumentFromRecord.DocumentField>
.filter(f -> f.getType().equals(LuceneIndexExpressions.DocumentFieldType.TEXT))
.map(f -> (String) f.getValue()).collect(Collectors.toList());
Document document = new Document();
if (autoCompleteEnabled) {
List<String> nestedFields = fields.stream()
.filter(f -> f.isNested())
.filter(f -> f.getType().equals(LuceneIndexExpressions.DocumentFieldType.TEXT))
.map(f -> (String) f.getValue()).collect(Collectors.toList());
if (nestedFields.size() > 0) {
document.add(new Field("TEXT_NESTED", Joiner.on(" ").join(nestedFields), getAutoCompleteTextFieldType()));
}
}
final IndexWriter newWriter = directoryManager.getIndexWriter(groupingKey,
indexAnalyzerChooser.chooseAnalyzer(texts));
BytesRef ref = new BytesRef(primaryKey);
Expand Down Expand Up @@ -343,23 +333,6 @@ private FieldType getTextFieldType(LuceneDocumentFromRecord.DocumentField field)
return ft;
}

private FieldType getAutoCompleteTextFieldType() {
FieldType ft = new FieldType();

try {
ft.setIndexOptions(IndexOptions.DOCS);
ft.setTokenized(true);
ft.setStored(false);
ft.setStoreTermVectors(false);
ft.setOmitNorms(true);
ft.freeze();
} catch (ClassCastException ex) {
throw new RecordCoreArgumentException("Invalid value type for Lucene field config", ex);
}

return ft;
}

private static IndexOptions getIndexOptions(@Nonnull String value) {
try {
return IndexOptions.valueOf(value);
Expand Down

0 comments on commit fb8d0db

Please sign in to comment.