This commit is contained in:
2018-09-21 17:35:47 +00:00
parent 93942d6d8f
commit d204d9f20c
3 changed files with 24 additions and 4 deletions

View File

@@ -35,6 +35,9 @@ IMMEDIATE ITEMS:
- Add tests for searching and routes, test all variants of search including rights related stuff
- Update all the seeder code to add search indexing so can properly test huge search datasets
- Need to find a way to add random text to Notes fields that varies but has some overlap ideally
- bugbug: why is the single letter a being indexed? Missing shortness filter??
- bugbug: in searchkey an item will appear twice if the keywords appear in both the name and the text
- Update all the other routes to include search indexing (attachments, tags etc, anything with text in it)
- EventLogProcessor.AddEntry: CHANGE this to save the context itself and then change all callers to handle that (remove save)
- I originally didn't have the save in there because I thought subsequent code might all share in the single context save,

View File

@@ -173,8 +173,10 @@ namespace AyaNova.Biz
//SEARCH SEARCHKEY FOR MATCHING WORDS AND OPTIONALLY TYPE AND INNAME
var TestRawMatches = await ct.SearchKey.Where(x => DictionaryMatches.Contains(x.WordId)).ToListAsync();
//Build search query based on searchParameters
var q = ct.SearchKey.Distinct().Where(m => DictionaryMatches.Contains(m.Id));
var q = ct.SearchKey.Distinct().Where(x => DictionaryMatches.Contains(x.WordId));
//In name?
if (searchParameters.NameOnly)

View File

@@ -19,6 +19,7 @@ namespace raven_integration
[Fact]
public async void PhraseOnlySearchShouldWork()
{
const string TEST_SEARCH_PHRASE = "simple dogs";
//CREATE A WIDGET
dynamic D = new JObject();
@@ -32,8 +33,21 @@ namespace raven_integration
Util.ValidateDataReturnResponseOk(a);
long FirstWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
//CREATE A SECOND WIDGET
D = new JObject();
D.name = Util.Uniquify("Search Simple SECOND Test WIDGET");
D.name = Util.Uniquify("Search simple as in dogs SECOND Test WIDGET");
D.dollarAmount = 1.11m;
D.active = true;
D.roles = 0;
D.notes = "This Widget should be returned in the search as it contains both keywords in the name";
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
Util.ValidateDataReturnResponseOk(a);
long SecondWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
//CREATE A THIRD WIDGET
D = new JObject();
D.name = Util.Uniquify("Search Simple THIRD Test WIDGET");
D.dollarAmount = 1.11m;
D.active = true;
D.roles = 0;
@@ -41,11 +55,12 @@ namespace raven_integration
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
Util.ValidateDataReturnResponseOk(a);
long SecondWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
long ThirdWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
//Now see if can find that widget with a phrase search
dynamic SearchParameters = new JObject();
SearchParameters.phrase = "simple dogs";
SearchParameters.phrase = TEST_SEARCH_PHRASE;
SearchParameters.nameOnly = false;
SearchParameters.typeOnly = 0;//no type
a = await Util.PostAsync("Search", await Util.GetTokenAsync("manager", "l3tm3in"), SearchParameters.ToString());