Skip to content

Commit

Permalink
LanguageFallbackItemSwitcher context lost when computed index fields …
Browse files Browse the repository at this point in the history
…are added in parallel
  • Loading branch information
PaulStupka committed Dec 13, 2016
1 parent 9d41fc4 commit 06d1d48
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@ public LuceneDocumentBuilder(IIndexable indexable, IProviderUpdateContext contex
protected override void AddComputedIndexFieldsInParallel()
{
ConcurrentQueue<Exception> exceptions = new ConcurrentQueue<Exception>();
var needEnterLanguageFallbackItemSwitcher = LanguageFallbackItemSwitcher.CurrentValue;
Parallel.ForEach<IComputedIndexField>(base.Options.ComputedIndexFields, base.ParallelOptions, delegate (IComputedIndexField computedIndexField, ParallelLoopState parallelLoopState)
{
object fieldValue;
try
{
using (new LanguageFallbackFieldSwitcher(this.Index.EnableFieldLanguageFallback))
using (new LanguageFallbackItemSwitcher(needEnterLanguageFallbackItemSwitcher))
{
fieldValue = computedIndexField.ComputeFieldValue(this.Indexable);
}
using (new LanguageFallbackFieldSwitcher(this.Index.EnableFieldLanguageFallback))
{
fieldValue = computedIndexField.ComputeFieldValue(this.Indexable);
}
}
}
catch (Exception ex)
{
Expand Down

0 comments on commit 06d1d48

Please sign in to comment.