Skip to content

Commit 488ef0b

Browse files
committed
Add unit test in attempt to reproduce #960
1 parent 261b89b commit 488ef0b

File tree

2 files changed

+66
-13
lines changed

2 files changed

+66
-13
lines changed

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
</Reference>
6767
<Reference Include="System" />
6868
<Reference Include="System.Core" />
69-
<Reference Include="System.Net.Http" />
7069
<Reference Include="System.Runtime.Serialization" />
7170
<Reference Include="System.Xml.Linq" />
7271
<Reference Include="System.Data.DataSetExtensions" />
@@ -111,17 +110,13 @@
111110
<Compile Include="Core\Cat\CatTests.cs" />
112111
<Compile Include="Core\Explain\ExplainTests.cs" />
113112
<Compile Include="Core\Exists\AliasExists.cs" />
114-
<Compile Include="Core\Repository\CreateRepositoryTests.cs" />
115-
<Compile Include="Core\SearchShards\SearchShardsTests.cs" />
116113
<Compile Include="Core\GetFieldMapping\GetFieldMappingTests.cs" />
117114
<Compile Include="Core\MultiPercolate\MultiPercolateTests.cs" />
118115
<Compile Include="Core\Percolate\PercolateTests.cs" />
119116
<Compile Include="Core\Map\Mapping\MappingTransformTests.cs" />
120117
<Compile Include="Core\PingTests.cs" />
121-
<Compile Include="Core\Repository\SnapshotStatusTests.cs" />
122-
<Compile Include="Core\Repository\RestoreStatusTests.cs" />
123118
<Compile Include="Core\Repository\RestoreTests.cs" />
124-
<Compile Include="Core\Repository\GetRepositoryTests.cs" />
119+
<Compile Include="Core\Repository\CreateRepositoryTests.cs" />
125120
<Compile Include="Core\ClearScroll\ClearScrollTests.cs" />
126121
<Compile Include="Core\Exists\DocumentExistsTests.cs" />
127122
<Compile Include="Core\Suggest\SuggestTests.cs" />
@@ -176,9 +171,8 @@
176171
<Compile Include="Indices\StatsTests.cs" />
177172
<Compile Include="Core\AsyncTests.cs" />
178173
<Compile Include="Mapping\MappingVisitorTests.cs" />
179-
<Compile Include="Reproduce\Reproduce953Tests.cs" />
180-
<Compile Include="Reproduce\Reproduce945Tests.cs" />
181174
<Compile Include="Reproduce\Reproduce769Tests.cs" />
175+
<Compile Include="Reproduce\Reproduce960Tests.cs" />
182176
<Compile Include="Search\Filter\AndOrNotFilterTests.cs" />
183177
<Compile Include="Search\Filter\ScriptFilterTests.cs" />
184178
<Compile Include="Search\Filter\MissingExistsFilterTests.cs" />
@@ -246,15 +240,10 @@
246240
<Compile Include="Search\VersionTests.cs" />
247241
<Compile Include="Search\ExplainTests.cs" />
248242
<Compile Include="Startup\StartupTests.cs" />
249-
<Compile Include="Template\TemplateTests.cs" />
250243
<Compile Include="Warmers\IndicesWarmersTests.cs" />
251244
<Compile Include="Warmers\WarmersTests.cs" />
252245
</ItemGroup>
253246
<ItemGroup>
254-
<ProjectReference Include="..\..\Connections\Elasticsearch.Net.Connection.HttpClient\Elasticsearch.Net.Connection.HttpClient.csproj">
255-
<Project>{a69322fd-b874-44ef-abe0-63f4a7b5593e}</Project>
256-
<Name>Elasticsearch.Net.Connection.HttpClient</Name>
257-
</ProjectReference>
258247
<ProjectReference Include="..\..\Elasticsearch.Net\Elasticsearch.Net.csproj">
259248
<Project>{e97ccf40-0ba6-43fe-9f2d-58d454134088}</Project>
260249
<Name>Elasticsearch.Net</Name>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using NUnit.Framework;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using FluentAssertions;
8+
9+
namespace Nest.Tests.Integration.Reproduce
10+
{
11+
public class Document
12+
{
13+
public string DocNumber { get; set;}
14+
}
15+
16+
[TestFixture]
17+
public class Reproduce960Tests : IntegrationTests
18+
{
19+
[Test]
20+
public void PrefixQueryShouldReturnHits()
21+
{
22+
var settings = new IndexSettings();
23+
settings.NumberOfShards = 2;
24+
settings.Settings.Add("merge.policy.merge_factor", "5");
25+
settings.Settings.Add("search.slowlog.threshold.fetch.warn", "1s");
26+
27+
var index = "issue960";
28+
29+
if (this.Client.IndexExists(p => p.Index(index)).Exists)
30+
{
31+
this.Client.DeleteIndex(p => p.Index(index));
32+
}
33+
34+
var createResponse = this.Client.CreateIndex(index, c => c
35+
.AddMapping<Document>(m => m
36+
.Properties(p => p
37+
.String(s => s.Name(d => d.DocNumber).Analyzer("keyword")
38+
)
39+
)
40+
)
41+
);
42+
createResponse.IsValid.Should().BeTrue();
43+
44+
var document = new Document { DocNumber = "1.2345+t" };
45+
46+
var indexResponse = this.Client.Index<Document>(document, i => i
47+
.Index(index)
48+
.Refresh()
49+
);
50+
indexResponse.IsValid.Should().BeTrue();
51+
52+
var searchResponse = this.Client.Search<Document>(s => s
53+
.Index(index)
54+
.Type("document")
55+
.Query(q => q
56+
.Prefix(doc => doc.DocNumber, "1.2345+")
57+
)
58+
);
59+
60+
searchResponse.IsValid.Should().BeTrue();
61+
searchResponse.Hits.Count().ShouldBeEquivalentTo(1);
62+
}
63+
}
64+
}

0 commit comments

Comments
 (0)