Skip to content

Commit

Permalink
fix: correct regression in direct insert into index query
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Oct 20, 2023
1 parent 52df826 commit 61ed0ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ public static OIndexFactory getFactory(String indexType, String algorithm) {
algorithm = chooseDefaultIndexAlgorithm(indexType);
}

algorithm = algorithm.toUpperCase(Locale.ENGLISH);
final Iterator<OIndexFactory> ite = getAllFactories();
if (algorithm != null) {
algorithm = algorithm.toUpperCase(Locale.ENGLISH);
final Iterator<OIndexFactory> ite = getAllFactories();

while (ite.hasNext()) {
final OIndexFactory factory = ite.next();
if (factory.getTypes().contains(indexType) && factory.getAlgorithms().contains(algorithm)) {
return factory;
while (ite.hasNext()) {
final OIndexFactory factory = ite.next();
if (factory.getTypes().contains(indexType) && factory.getAlgorithms().contains(algorithm)) {
return factory;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class InsertIntoIndexStep extends AbstractExecutionStep {
private final OIndexIdentifier targetIndex;
private final OInsertBody body;

private boolean executed = false;
private OResultSet result;

public InsertIntoIndexStep(
OIndexIdentifier targetIndex,
Expand All @@ -36,7 +36,10 @@ public InsertIntoIndexStep(
@Override
public OResultSet syncPull(OCommandContext ctx, int nRecords) throws OTimeoutException {
getPrev().ifPresent(x -> x.syncPull(ctx, nRecords));
return new OProduceOneResult(() -> produce(ctx));
if (result == null) {
result = new OProduceOneResult(() -> produce(ctx));
}
return result;
}

private OResultInternal produce(OCommandContext ctx) {
Expand All @@ -60,7 +63,6 @@ private OResultInternal produce(OCommandContext ctx) {
count = handleKeyValues(body.getIdentifierList(), body.getValueExpressions(), index, ctx);
}

executed = true;
OResultInternal result = new OResultInternal();
result.setProperty("count", count);
return result;
Expand Down

0 comments on commit 61ed0ce

Please sign in to comment.