forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RavenDB-22410 Search - analyzer produces multiple tokens from a singl…
…e words
- Loading branch information
1 parent
cc8a4a1
commit 1963e09
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Linq; | ||
using FastTests; | ||
using Raven.Client.Documents; | ||
using Tests.Infrastructure; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace SlowTests.Issues; | ||
|
||
public class RavenDB_22410 : RavenTestBase | ||
{ | ||
public RavenDB_22410(ITestOutputHelper output) : base(output) | ||
{ | ||
} | ||
|
||
[RavenTheory(RavenTestCategory.Querying)] | ||
[RavenData(SearchEngineMode = RavenSearchEngineMode.All)] | ||
public void SearchMethodWhenWordIsTransformedIntoMultipleTokensWeTreatThemAsPhraseQuery(Options options) | ||
{ | ||
using var store = GetDocumentStore(options); | ||
using var session = store.OpenSession(); | ||
session.Store(new Dto("Din ner"), "Dtos/1"); | ||
session.Store(new Dto("Ner din"), "Dtos/2"); | ||
session.SaveChanges(); | ||
|
||
var results = session.Query<Dto>() | ||
.Customize(x => x.WaitForNonStaleResults()) | ||
.Search(x => x.Search, "din%ner") | ||
.ToList(); | ||
|
||
Assert.Equal(1, results.Count); | ||
Assert.Equal("Dtos/1", results[0].Id); | ||
} | ||
|
||
private record struct Dto(string Search, string Id = null); | ||
} |