Skip to content

Commit ff45122

Browse files
author
unknown
committed
Merge branch 'master' of git://github.com/Mpdreamz/NEST.git
2 parents 272067a + 512fc56 commit ff45122

39 files changed

+664
-361
lines changed

src/Nest.Connection.Thrift/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
[assembly: System.Runtime.InteropServices.ComVisible(false)]
1616
[assembly: System.CLSCompliant(true)]
1717
[assembly: System.Runtime.InteropServices.Guid("4d165338-2060-4641-8be6-b7aacbdee52d")]
18-
[assembly: System.Reflection.AssemblyVersion("0.11.1.0")]
19-
[assembly: System.Reflection.AssemblyFileVersion("0.11.1.0")]
18+
[assembly: System.Reflection.AssemblyVersion("0.11.2.0")]
19+
[assembly: System.Reflection.AssemblyFileVersion("0.11.2.0")]
2020

2121

src/Nest.Dsl.Factory/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
[assembly: System.Runtime.InteropServices.ComVisible(false)]
1717
[assembly: System.CLSCompliant(true)]
1818
[assembly: System.Runtime.InteropServices.Guid("665cc582-c91f-4f6c-924a-614289fa9449")]
19-
[assembly: System.Reflection.AssemblyVersion("0.11.1.0")]
20-
[assembly: System.Reflection.AssemblyFileVersion("0.11.1.0")]
19+
[assembly: System.Reflection.AssemblyVersion("0.11.2.0")]
20+
[assembly: System.Reflection.AssemblyFileVersion("0.11.2.0")]
2121

2222

src/Nest.Tests.Integration/Core/Bulk/BulkUpdateTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ public void BulkUpdateObject()
3535
result = this._client.Bulk(descriptor);
3636
result.Should().NotBeNull();
3737
result.IsValid.Should().BeTrue();
38+
result.Items.Count().Should().Be(1000);
39+
result.Items.All(i => i != null).Should().BeTrue();
40+
result.Items.All(i => i.OK).Should().BeTrue();
3841

3942
var updatedObject = this._client.Get<ElasticSearchProject>(5000);
4043
Assert.NotNull(updatedObject);

src/Nest.Tests.Integration/Integration/HighlightTests.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,20 @@ public void TestHighlight()
3434
Assert.DoesNotThrow(() => result.Highlights.Count());
3535
Assert.IsNotNull(result.Highlights);
3636
Assert.Greater(result.Highlights.Count(), 0);
37-
Assert.True(result.Highlights.Any(h => h.Highlights != null && h.Highlights.Any() && !string.IsNullOrEmpty(h.Highlights.First())));
37+
Assert.True(result.Highlights.All(h => h.Value != null));
38+
39+
Assert.True(result.Highlights.All(h => h.Value.All(hh => !hh.Value.DocumentId.IsNullOrEmpty())));
40+
41+
var id = result.Documents.First().Id.ToString();
42+
var highlights = result.Highlights[id];
43+
Assert.NotNull(highlights);
44+
Assert.NotNull(highlights["content"]);
45+
Assert.Greater(highlights["content"].Highlights.Count(), 0);
46+
47+
highlights = result.DocumentsWithMetaData.First().Highlight;
48+
Assert.NotNull(highlights);
49+
Assert.NotNull(highlights["content"]);
50+
Assert.Greater(highlights["content"].Highlights.Count(), 0);
3851
}
3952

4053
[Test]

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@
109109
<Compile Include="Integration\HighlightTests.cs" />
110110
<Compile Include="Integration\Query\TermQueryDynamic.cs" />
111111
<Compile Include="Mapping\NotAnalyzedTest.cs" />
112-
<Compile Include="Reproduce\ReproduceTests.cs" />
112+
<Compile Include="Reproduce\Reproduce308Tests.cs" />
113+
<Compile Include="Reproduce\Reproduce319Tests.cs" />
114+
<Compile Include="Reproduce\Reproduce211Tests.cs" />
113115
<Compile Include="Search\NamedFilter\NamedFilterTests.cs" />
114116
<Compile Include="Search\PercolateTests.cs" />
115117
<Compile Include="Search\CountTests.cs" />

src/Nest.Tests.Integration/Reproduce/ReproduceTests.cs renamed to src/Nest.Tests.Integration/Reproduce/Reproduce211Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Nest.Tests.Integration.Reproduce
1313
/// tests to reproduce reported errors
1414
/// </summary>
1515
[TestFixture]
16-
public class ReproduceTests : IntegrationTests
16+
public class Reproduce211Tests : IntegrationTests
1717
{
1818
public class Post
1919
{
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Nest.Tests.MockData;
5+
using Nest.Tests.MockData.Domain;
6+
using NUnit.Framework;
7+
using System.Diagnostics;
8+
using FluentAssertions;
9+
10+
namespace Nest.Tests.Integration.Reproduce
11+
{
12+
/// <summary>
13+
/// tests to reproduce reported errors
14+
/// </summary>
15+
[TestFixture]
16+
public class Reproduce308Tests : IntegrationTests
17+
{
18+
19+
/// <summary>
20+
/// https://github.com/Mpdreamz/NEST/issues/308
21+
/// </summary>
22+
[Test]
23+
public void ShouldBeAbleToSetIndexToReadonly()
24+
{
25+
var settings = new IndexSettings();
26+
settings.Similarity = new SimilaritySettings();
27+
settings.NumberOfReplicas = 1;
28+
settings.NumberOfShards = 5;
29+
settings.Add("index.blocks.read_only", "true");
30+
31+
var indexName = ElasticsearchConfiguration.NewUniqueIndexName();
32+
var idxRsp = this._client.CreateIndex(indexName, settings);
33+
Assert.IsTrue(idxRsp.IsValid, idxRsp.ConnectionStatus.ToString());
34+
35+
var getSettingsResponse = this._client.GetIndexSettings(indexName);
36+
Assert.IsTrue(getSettingsResponse.IsValid, getSettingsResponse.ConnectionStatus.ToString());
37+
38+
getSettingsResponse.Settings.Should().ContainKey("index.blocks.read_only");
39+
getSettingsResponse.Settings["index.blocks.read_only"].Should().Be("true");
40+
41+
42+
43+
}
44+
45+
}
46+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Nest.Tests.MockData;
5+
using Nest.Tests.MockData.Domain;
6+
using NUnit.Framework;
7+
using System.Diagnostics;
8+
using FluentAssertions;
9+
10+
namespace Nest.Tests.Integration.Reproduce
11+
{
12+
/// <summary>
13+
/// tests to reproduce reported errors
14+
/// </summary>
15+
[TestFixture]
16+
public class Reproduce319Tests : IntegrationTests
17+
{
18+
19+
/// <summary>
20+
/// https://github.com/Mpdreamz/NEST/issues/319
21+
/// </summary>
22+
[Test]
23+
public void CreateIndexShouldNotThrowNullReference()
24+
{
25+
var settings = new IndexSettings();
26+
settings.Similarity = new SimilaritySettings();
27+
settings.NumberOfReplicas = 1;
28+
settings.NumberOfShards = 5;
29+
settings.Add("index.refresh_interval", "10s");
30+
settings.Add("merge.policy.merge_factor", "10");
31+
settings.Add("search.slowlog.threshold.fetch.warn", "1s");
32+
settings.Analysis.Analyzers.Add(new KeyValuePair<string, AnalyzerBase>("keyword", new KeywordAnalyzer()));
33+
settings.Analysis.Analyzers.Add(new KeyValuePair<string, AnalyzerBase>("simple", new SimpleAnalyzer()));
34+
settings.Mappings.Add(new RootObjectMapping
35+
{
36+
Name = "my_root_object",
37+
Properties = new Dictionary<string, IElasticType>
38+
{
39+
{"my_field", new StringMapping() { Name = "my_string_field "}}
40+
}
41+
});
42+
43+
Assert.DoesNotThrow(() =>
44+
{
45+
var idxRsp = this._client.CreateIndex(ElasticsearchConfiguration.NewUniqueIndexName(), settings);
46+
Assert.IsTrue(idxRsp.IsValid, idxRsp.ConnectionStatus.ToString());
47+
});
48+
}
49+
50+
}
51+
}

src/Nest.Tests.Integration/Search/QueryResponseMapperTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ public void QueryWithHighlightTest()
530530
var queryResults = this._client.SearchRaw<ElasticSearchProject>(query);
531531

532532
//assert
533-
Assert.IsTrue(queryResults.DocumentsWithMetaData.First().Highlight["content"].Count > 0);
533+
Assert.IsTrue(queryResults.DocumentsWithMetaData.First().Highlight["content"].Highlights.Count() > 0);
534+
534535
}
535536
}
536537
}

src/Nest.Tests.Unit/Core/Get/GetFullTests.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,7 @@ public void GetUsingDescriptor()
4141
var status = result.ConnectionStatus;
4242
StringAssert.EndsWith("/myindex/elasticsearchprojects/404", status.RequestUrl);
4343
}
44-
[Test]
45-
public void GetUsingDescriptorEscapes()
46-
{
47-
var result = this._client.GetFull<ElasticSearchProject>(g => g
48-
.Index("myindex")
49-
.Id("myid/with/slashes")
50-
);
51-
var status = result.ConnectionStatus;
52-
StringAssert.EndsWith("/myindex/elasticsearchprojects/myid%252Fwith%252Fslashes", status.RequestUrl);
53-
}
44+
5445
[Test]
5546
public void GetUsingDescriptorWithType()
5647
{

0 commit comments

Comments
 (0)