As alluded to in #117, a FullTextIndexBuilder doesn't really follow the best practice for builders which is for each action to return a clone of the previous instance with the changes applied.
At the moment this won't do what some might expect:
var coreBuilder = new FullTextIndexBuilder<int>();
var index1 = coreBuilder.WithIndexModificationAction(async (idx) => // Do something).Build();
var index2 = coreBuilder.WithIndexModificationAction(async (idx) => // Do something).Build();
Because the coreBuilder instance will end up with two index modification actions when index2 is built.
Either:
- Builder instances need to be immutable
- An exception should be thrown if Build is called multiple times
- An exception should be thrown if the builder is mutated after it has been built (this would at least allow for multiple calls of Builds)
- Something else I haven't thought of yet.
As alluded to in #117, a
FullTextIndexBuilderdoesn't really follow the best practice for builders which is for each action to return a clone of the previous instance with the changes applied.At the moment this won't do what some might expect:
Because the
coreBuilderinstance will end up with two index modification actions whenindex2is built.Either: