Fielddata: Fix thread safety issue with field data on the `_index` field.

This commit is contained in:
Adrien Grand 2014-07-24 18:59:44 +02:00
parent 89e03910f4
commit a3d8022dc5
1 changed files with 12 additions and 12 deletions

View File

@ -43,9 +43,19 @@ public class IndexIndexFieldData extends AbstractIndexOrdinalsFieldData {
private static class IndexAtomicFieldData extends AbstractAtomicOrdinalsFieldData {
private final RandomAccessOrds values;
private final String index;
IndexAtomicFieldData(String index) {
this.index = index;
}
@Override
public long ramBytesUsed() {
return 0;
}
@Override
public RandomAccessOrds getOrdinalsValues() {
final BytesRef term = new BytesRef(index);
final SortedDocValues sortedValues = new SortedDocValues() {
@ -64,17 +74,7 @@ public class IndexIndexFieldData extends AbstractIndexOrdinalsFieldData {
return 0;
}
};
values = (RandomAccessOrds) DocValues.singleton(sortedValues);
}
@Override
public long ramBytesUsed() {
return 0;
}
@Override
public RandomAccessOrds getOrdinalsValues() {
return values;
return (RandomAccessOrds) DocValues.singleton(sortedValues);
}
@Override