Skip to content
Permalink
Browse files
Merge pull request #550 from rishabhdaim/OAK-9751
OAK-9751 : handled cases where path changes in lucene exceeds max bui…
  • Loading branch information
mreutegg committed Apr 26, 2022
2 parents 6ca4dd7 + ecef552 commit 6d285e77523127d885b8bd2dfe84dd0dc141aa19
Showing 2 changed files with 20 additions and 1 deletion.
@@ -91,8 +91,9 @@ public void addSerializedProperty(@Nullable String json) {
if (!first) {
reader.read(',');
}
String s = reader.readString();
if (sizeWithinLimits()) {
indexedNodes.put(path, reader.readString());
indexedNodes.put(path, s);
}
}
} while (reader.matches(','));
@@ -53,7 +53,25 @@ public void nullOrEmptyJson() throws Exception{

assertTrue(Iterables.isEmpty(((IndexedPaths)builder2.build())));
}
@Test
public void addJsonLessThanMaxBuilderSize() throws Exception {
String a = null;
for (int i = 0; i < 499; i++) {
a = "{\"/var/eventing/jobs/foo/2022/4/19/14/27/af96fcfa9e32_8589" + i + "\" :[\"/oak:index/foo\",\"/oak:index/bar\"]}";
builder.addSerializedProperty(a);
}
assertEquals(998, createdIndexPathMap((IndexedPaths)builder.build()).size());
}

@Test
public void addJsonBiggerThanMaxBuilderSize() throws Exception {
String a = null;
for (int i = 0; i < 502; i++) {
a = "{\"/var/eventing/jobs/foo/2022/4/19/14/27/af96fcfa9e32_8589" + i + "\" :[\"/oak:index/foo\",\"/oak:index/bar\"]}";
builder.addSerializedProperty(a);
}
assertEquals(1000, createdIndexPathMap((IndexedPaths)builder.build()).size());
}
@Test
public void addMulti() throws Exception{
LuceneDocumentHolder h1 = createHolder();

0 comments on commit 6d285e7

Please sign in to comment.