Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change GenericProperty.Index to bool? #3224

Merged
merged 1 commit into from
Apr 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .paket/Paket.Restore.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@

<!-- Because ReadAllText is slow on osx/linux, try to find shasum and awk -->
<PropertyGroup>
<PaketRestoreCachedHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreCachedHasher)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum $(PaketRestoreCacheFile) | /usr/bin/awk '{ print $1 }'</PaketRestoreCachedHasher>
<PaketRestoreLockFileHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreLockFileHash)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum $(PaketLockFilePath) | /usr/bin/awk '{ print $1 }'</PaketRestoreLockFileHasher>
<PaketRestoreCachedHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreCachedHasher)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum "$(PaketRestoreCacheFile)" | /usr/bin/awk '{ print $1 }'</PaketRestoreCachedHasher>
<PaketRestoreLockFileHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreLockFileHash)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum "$(PaketLockFilePath)" | /usr/bin/awk '{ print $1 }'</PaketRestoreLockFileHasher>
</PropertyGroup>

<!-- If shasum and awk exist get the hashes -->
Expand Down
17 changes: 0 additions & 17 deletions src/Nest/Mapping/FieldIndexOption.cs

This file was deleted.

10 changes: 4 additions & 6 deletions src/Nest/Mapping/Types/Specialized/Generic/GenericProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Nest
public interface IGenericProperty : IDocValuesProperty
{
[JsonProperty("index")]
FieldIndexOption? Index { get; set; }
bool? Index { get; set; }

[JsonProperty("term_vector")]
TermVectorOption? TermVector { get; set; }
Expand Down Expand Up @@ -60,7 +60,7 @@ public class GenericProperty : DocValuesPropertyBase, IGenericProperty
public int? IgnoreAbove { get; set; }
public int? PositionIncrementGap { get; set; }
public IStringFielddata Fielddata { get; set; }
public FieldIndexOption? Index { get; set; }
public bool? Index { get; set; }
public string NullValue { get; set; }
public bool? Norms { get; set; }
public IndexOptions? IndexOptions { get; set; }
Expand All @@ -82,7 +82,7 @@ public class GenericPropertyDescriptor<T>
: DocValuesPropertyDescriptorBase<GenericPropertyDescriptor<T>, IGenericProperty, T>, IGenericProperty
where T : class
{
FieldIndexOption? IGenericProperty.Index { get; set; }
bool? IGenericProperty.Index { get; set; }
TermVectorOption? IGenericProperty.TermVector { get; set; }
double? IGenericProperty.Boost { get; set; }
string IGenericProperty.NullValue { get; set; }
Expand All @@ -98,14 +98,12 @@ public class GenericPropertyDescriptor<T>

public GenericPropertyDescriptor<T> Type(string type) => Assign(a => this.TypeOverride = type);

public GenericPropertyDescriptor<T> Index(FieldIndexOption? index = FieldIndexOption.NotAnalyzed) => Assign(a => a.Index = index);
public GenericPropertyDescriptor<T> Index(bool? index = true) => Assign(a => a.Index = index);

public GenericPropertyDescriptor<T> Boost(double? boost) => Assign(a => a.Boost = boost);

public GenericPropertyDescriptor<T> NullValue(string nullValue) => Assign(a => a.NullValue = nullValue);

public GenericPropertyDescriptor<T> NotAnalyzed() => Index(FieldIndexOption.NotAnalyzed);

public GenericPropertyDescriptor<T> TermVector(TermVectorOption? termVector) => Assign(a => a.TermVector = termVector);

public GenericPropertyDescriptor<T> IndexOptions(IndexOptions? indexOptions) => Assign(a => a.IndexOptions = indexOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto
{"any.setting", "can be set"},
{"doubles", 1.1},
{"bools", false},
{"enums", "analyzed"},
{"enums", "offsets"},
{"index.number_of_replicas", 2},
{"index.auto_expand_replicas", "1-3" },
{"index.refresh_interval", -1 },
Expand All @@ -42,7 +42,7 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto
.Setting("any.setting", "can be set")
.Setting("doubles", 1.1)
.Setting("bools", false)
.Setting("enums", FieldIndexOption.Analyzed)
.Setting("enums", IndexOptions.Offsets)
.NumberOfShards(1)
.NumberOfReplicas(2)
.AutoExpandReplicas("1-3")
Expand All @@ -67,7 +67,7 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto
{ "any.setting", "can be set" },
{ "doubles", 1.1 },
{ "bools", false },
{ "enums", FieldIndexOption.Analyzed },
{ "enums", IndexOptions.Offsets },
})
{
NumberOfShards = 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected override LazyResponses ClientUsage() => Calls(
match_mapping_type = "*",
mapping = new
{
index = "no"
index = false
}
}
}
Expand All @@ -74,7 +74,7 @@ protected override LazyResponses ClientUsage() => Calls(
.MatchMappingType("*")
.Mapping(mm => mm
.Generic(g => g
.Index(FieldIndexOption.No)
.Index(false)
)
)
)
Expand Down Expand Up @@ -106,7 +106,7 @@ protected override LazyResponses ClientUsage() => Calls(
MatchMappingType = "*",
Mapping = new GenericProperty
{
Index = FieldIndexOption.No
Index = false
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ public class GenericPropertyTests : SingleMappingPropertyTestsBase
private const string GenericType = "{dynamic_type}";
public GenericPropertyTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { }

protected override object SingleMappingJson { get; } = new {index = "no", type= GenericType};
protected override object SingleMappingJson { get; } = new {index = false, type= GenericType};

protected override Func<SingleMappingSelector<object>, IProperty> FluentSingleMapping => m => m
.Generic(g => g
.Type(GenericType)
.Index(FieldIndexOption.No)
.Index(false)
);

protected override IProperty InitializerSingleMapping { get; } = new GenericProperty
{
Type = GenericType,
Index = FieldIndexOption.No
Index = false
};
}
}