Skip to content

Add indexNullState and indexPropertyLength field support in InvertedIndexConfig #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ public class InvertedIndexConfig {
StopwordConfig stopwords;
Integer cleanupIntervalSeconds;
Boolean indexTimestamps;
Boolean indexNullState;
Boolean indexPropertyLength;
}
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,62 @@ public void testCreateClassWithBM25Config() {
assertEquals(bm25Config.getK1(), bandClass.getResult().getInvertedIndexConfig().getBm25().getK1());
}

@Test
public void testCreateClassWithInvertedIndexContainingIndexNullState() {
// given
InvertedIndexConfig invertedIndexConfig = InvertedIndexConfig.builder()
.indexNullState(true)
.build();

WeaviateClass clazz = WeaviateClass.builder()
.className("Band")
.description("Band that plays and produces music")
.vectorIndexType("hnsw")
.vectorizer("text2vec-contextionary")
.invertedIndexConfig(invertedIndexConfig)
.build();

// when
Result<Boolean> createStatus = client.schema().classCreator().withClass(clazz).run();
Result<WeaviateClass> bandClass = client.schema().classGetter().withClassName(clazz.getClassName()).run();

// then
assertNotNull(createStatus);
assertTrue(createStatus.getResult());
assertNotNull(bandClass);
assertNotNull(bandClass.getResult());
assertNull(bandClass.getError());
assertTrue(bandClass.getResult().getInvertedIndexConfig().getIndexNullState());
}

@Test
public void testCreateClassWithInvertedIndexContainingIndexPropertyLength() {
// given
InvertedIndexConfig invertedIndexConfig = InvertedIndexConfig.builder()
.indexPropertyLength(true)
.build();

WeaviateClass clazz = WeaviateClass.builder()
.className("Band")
.description("Band that plays and produces music")
.vectorIndexType("hnsw")
.vectorizer("text2vec-contextionary")
.invertedIndexConfig(invertedIndexConfig)
.build();

// when
Result<Boolean> createStatus = client.schema().classCreator().withClass(clazz).run();
Result<WeaviateClass> bandClass = client.schema().classGetter().withClassName(clazz.getClassName()).run();

// then
assertNotNull(createStatus);
assertTrue(createStatus.getResult());
assertNotNull(bandClass);
assertNotNull(bandClass.getResult());
assertNull(bandClass.getError());
assertTrue(bandClass.getResult().getInvertedIndexConfig().getIndexPropertyLength());
}

@Test
public void testCreateClassWithStopwordsConfig() {
// given
Expand Down