Skip to content

Commit 302a2aa

Browse files
committed
GeoShape implement IGeoShape
Correct spelling in assembly descriptions fixes #1908
1 parent 56d9efa commit 302a2aa

File tree

8 files changed

+140
-15
lines changed

8 files changed

+140
-15
lines changed

build/scripts/Projects.fsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ type ProjectName(msbuild: string) =
1111
member this.NugetDescription =
1212
match this.Nuget.ToLowerInvariant() with
1313
| f when f = "elasticsearch.net" ->
14-
Some "Elasticsearch.Net - oficial low level elasticsearch client"
14+
Some "Elasticsearch.Net - official low level elasticsearch client"
1515
| f when f = "nest" ->
16-
Some "NEST - oficial high level elasticsearch client"
16+
Some "NEST - official high level elasticsearch client"
1717
| f when f = "elasticsearch.net.connection.thrift" ->
1818
Some "Add thrift support to elasticsearch."
1919
| f when f = "elasticsearch.net.connection.httpclient" ->

build/scripts/Signing.fsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ open Projects
1010
type Sign() =
1111
static let sn = if isMono then "sn" else Paths.Tool("sn/sn.exe")
1212
static let keyFile = Paths.Keys("keypair.snk");
13-
static let oficialToken = "96c599bbe3e70f5d"
13+
static let officialToken = "96c599bbe3e70f5d"
1414

1515
static let validate dll name =
1616
let out = (ExecProcessAndReturnMessages(fun p ->
@@ -33,9 +33,9 @@ type Sign() =
3333

3434
let valid = (out.ExitCode, token)
3535
match valid with
36-
| (0, t) when t = oficialToken ->
36+
| (0, t) when t = officialToken ->
3737
trace (sprintf "%s was signed with official key token %s" name t)
38-
| (_, t) -> traceFAKE "%s was not signed with the official token: %s but %s" name oficialToken t
38+
| (_, t) -> traceFAKE "%s was not signed with the official token: %s but %s" name officialToken t
3939

4040
static member CreateKeys () =
4141
ExecProcess(fun p ->

src/Elasticsearch.Net/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[assembly: AssemblyTitleAttribute("Elasticsearch.Net")]
55
[assembly: AssemblyCopyrightAttribute("Elasticsearch 2016")]
6-
[assembly: AssemblyDescriptionAttribute("Elasticsearch.Net - oficial low level elasticsearch client")]
6+
[assembly: AssemblyDescriptionAttribute("Elasticsearch.Net - official low level elasticsearch client")]
77
[assembly: AssemblyCompanyAttribute("Elasticsearch")]
88
[assembly: AssemblyConfigurationAttribute("Release")]
99
[assembly: AssemblyVersionAttribute("1.0.0")]

src/Nest/Domain/Geo/GeoShape.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public interface IGeoShape
1212
string Type { get; }
1313
}
1414

15-
public abstract class GeoShape
15+
public abstract class GeoShape : IGeoShape
1616
{
1717
public GeoShape(string type)
1818
{

src/Nest/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[assembly: AssemblyTitleAttribute("Nest")]
55
[assembly: AssemblyCopyrightAttribute("Elasticsearch 2016")]
6-
[assembly: AssemblyDescriptionAttribute("NEST - oficial high level elasticsearch client")]
6+
[assembly: AssemblyDescriptionAttribute("NEST - official high level elasticsearch client")]
77
[assembly: AssemblyCompanyAttribute("Elasticsearch")]
88
[assembly: AssemblyConfigurationAttribute("Release")]
99
[assembly: AssemblyVersionAttribute("1.0.0")]

src/Tests/Nest.Tests.Integration/IntegrationTests.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ namespace Nest.Tests.Integration
99
{
1010
public class IntegrationTests
1111
{
12-
13-
protected IElasticClient Client { get { return ElasticsearchConfiguration.Client.Value; } }
14-
protected IElasticClient ClientThatThrows { get { return ElasticsearchConfiguration.ClientThatThrows.Value; } }
15-
protected IElasticClient ClientNoRawResponse { get { return ElasticsearchConfiguration.ClientNoRawResponse.Value; } }
16-
protected ElasticClient ThriftClient { get { return ElasticsearchConfiguration.ThriftClient.Value; } }
17-
18-
protected IConnectionSettingsValues Settings { get { return ElasticsearchConfiguration.Settings(); } }
12+
protected virtual IElasticClient Client { get { return ElasticsearchConfiguration.Client.Value; } }
13+
protected virtual IElasticClient ClientThatThrows { get { return ElasticsearchConfiguration.ClientThatThrows.Value; } }
14+
protected virtual IElasticClient ClientNoRawResponse { get { return ElasticsearchConfiguration.ClientNoRawResponse.Value; } }
15+
protected virtual ElasticClient ThriftClient { get { return ElasticsearchConfiguration.ThriftClient.Value; } }
16+
protected virtual IConnectionSettingsValues Settings { get { return ElasticsearchConfiguration.Settings(); } }
1917

2018
protected ISearchResponse<T> SearchRaw<T>(string query) where T : class
2119
{

src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
<Compile Include="Reproduce\Reproduce1474Tests.cs" />
184184
<Compile Include="Reproduce\Reproduce1515Tests.cs" />
185185
<Compile Include="Reproduce\Reproduce1591Tests.cs" />
186+
<Compile Include="Reproduce\Reproduce1908Tests.cs" />
186187
<Compile Include="Reproduce\Reproduce769Tests.cs" />
187188
<Compile Include="Reproduce\Reproduce945Tests.cs" />
188189
<Compile Include="Reproduce\Reproduce953Tests.cs" />
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using NUnit.Framework;
6+
7+
namespace Nest.Tests.Integration.Reproduce
8+
{
9+
[TestFixture]
10+
public class Reproduce1908Tests : IntegrationTests
11+
{
12+
private const string DefaultIndex = "reproduce1908";
13+
14+
public class Polygon
15+
{
16+
public PolygonGeoShape VertexValues { get; set; }
17+
}
18+
19+
protected override IElasticClient Client
20+
{
21+
get
22+
{
23+
return new ElasticClient(Settings);
24+
}
25+
}
26+
27+
protected override IConnectionSettingsValues Settings
28+
{
29+
get
30+
{
31+
return new ConnectionSettings(ElasticsearchConfiguration.CreateBaseUri(), DefaultIndex)
32+
.SetMaximumAsyncConnections(ElasticsearchConfiguration.MaxConnections)
33+
.DisableAutomaticProxyDetection(false)
34+
.PrettyJson()
35+
.ExposeRawResponse()
36+
.SetDefaultPropertyNameInferrer(p => p)
37+
.SetConnectionStatusHandler(r =>
38+
{
39+
// log out the requests
40+
if (r.Request != null)
41+
{
42+
Console.WriteLine("{0} {1} \n{2}\n", r.RequestMethod.ToUpperInvariant(), r.RequestUrl,
43+
Encoding.UTF8.GetString(r.Request));
44+
}
45+
else
46+
{
47+
Console.WriteLine("{0} {1}\n", r.RequestMethod.ToUpperInvariant(), r.RequestUrl);
48+
}
49+
50+
if (r.ResponseRaw != null)
51+
{
52+
Console.WriteLine("Status: {0}\n{1}\n\n{2}\n",
53+
r.HttpStatusCode,
54+
Encoding.UTF8.GetString(r.ResponseRaw),
55+
new string('-', 30));
56+
}
57+
else
58+
{
59+
Console.WriteLine("Status: {0}\n\n{1}\n",
60+
r.HttpStatusCode,
61+
new string('-', 30));
62+
}
63+
});
64+
}
65+
}
66+
67+
[Test]
68+
public void TypePropertySerializesLowercaseWhenUsingPascalPropertyNameInferrer()
69+
{
70+
if (Client.IndexExists(DefaultIndex).Exists)
71+
Client.DeleteIndex(DefaultIndex);
72+
73+
Client.CreateIndex(DefaultIndex, c => c
74+
.AddMapping<Polygon>(m => m
75+
.MapFromAttributes()
76+
.Properties(p => p
77+
.GeoShape(g => g
78+
.Name(f => f.VertexValues)
79+
)
80+
)
81+
)
82+
);
83+
84+
Client.Index(new Polygon
85+
{
86+
VertexValues = new PolygonGeoShape
87+
{
88+
Coordinates = new List<List<List<double>>>
89+
{
90+
new List<List<double>>
91+
{
92+
new List<double> { 45.50537109375, 1.186438639445215 },
93+
new List<double> { 49.41650390625, 5.922044619883305 },
94+
new List<double> { 54.5141601562, 3.9957805129630253 },
95+
new List<double> { 52.7124023437, -1.208406497271858 },
96+
new List<double> { 48.3837890625, -0.615222552406841 },
97+
new List<double> { 45.50537109375, 1.186438639445215 },
98+
}
99+
},
100+
}
101+
});
102+
103+
Client.Refresh(r => r.Index(DefaultIndex));
104+
105+
var coordinates = new[] { 48.864686, 2.351616 };
106+
107+
var response1 = Client.Search<Polygon>(x => x
108+
.Query(q => q
109+
.Filtered(f => f
110+
.Filter(g => g
111+
.GeoShapePoint("VertexValues", d => d
112+
.Coordinates(coordinates)
113+
.Relation(GeoShapeRelation.Intersects)
114+
)
115+
)
116+
)
117+
)
118+
);
119+
120+
Assert.IsTrue(response1.IsValid);
121+
Assert.IsTrue(response1.Documents.Count() == 1);
122+
123+
Client.DeleteIndex(DefaultIndex);
124+
}
125+
}
126+
}

0 commit comments

Comments
 (0)