This commit is contained in:
2018-09-28 18:10:47 +00:00
parent 70fc47177f
commit d1b6a7d747
4 changed files with 54 additions and 7 deletions

View File

@@ -28,11 +28,11 @@ Once that is done then can steam ahead on the biz objects but until I have the c
IMMEDIATE ITEMS: IMMEDIATE ITEMS:
================ ================
- Testing issue with event log tests, see the test for details
- Search and search text indexing - Search and search text indexing
- Create a test for search that searches the widgets LOREM text - Create a test for search that searches the widgets LOREM text
- Test with huge dataset for performance testing - Test with huge dataset for performance testing
- Need to be able to specify max results, code that shit!
- bugbug: why is the single letter a being indexed? Missing shortness filter, A not in stopwords for english?? - bugbug: why is the single letter a being indexed? Missing shortness filter, A not in stopwords for english??
- Update all the other routes to include search indexing (attachments, tags etc, anything with text in it) - Update all the other routes to include search indexing (attachments, tags etc, anything with text in it)
@@ -56,7 +56,9 @@ IMMEDIATE ITEMS:
- Give widgets a visible ID number scheme and add to tests - Give widgets a visible ID number scheme and add to tests
- Ensure search code process keywords includes the Visible ID value andadd test for that in Search indexing tests - Ensure search code process keywords includes the Visible ID value andadd test for that in Search indexing tests
- Why are exceptions that are triggered intentionally in intengration tests showing in the console?
- Shouldn't that shit log only to text file??
- Does it matter even though?
Ensure all modern best practice security is properly enabled on helloayanova.com so testing is valid Ensure all modern best practice security is properly enabled on helloayanova.com so testing is valid
- https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security#Deployment_best_practices - https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security#Deployment_best_practices

View File

@@ -72,12 +72,14 @@ namespace AyaNova.Biz
public bool NameOnly { get; set; } public bool NameOnly { get; set; }
public AyaType TypeOnly { get; set; } public AyaType TypeOnly { get; set; }
public List<long> Tags { get; set; } public List<long> Tags { get; set; }
public int MaxResults { get; set; }
public SearchRequestParameters() public SearchRequestParameters()
{ {
NameOnly = false; NameOnly = false;
TypeOnly = AyaType.NoType; TypeOnly = AyaType.NoType;
Tags = new List<long>(); Tags = new List<long>();
MaxResults = 500;
} }
public bool IsValid public bool IsValid
@@ -313,6 +315,11 @@ namespace AyaNova.Biz
MatchingObjects = CanReadMatchingObjects; MatchingObjects = CanReadMatchingObjects;
} }
//MAXIMUM RESULTS FILTER
//The theory is that it should be filtered BEFORE sorting so that you get the most random collection of results
//As the results are not ranked so...
MatchingObjects=MatchingObjects.Take(searchParameters.MaxResults).ToList();
//Sort and group the matching objects list in return order //Sort and group the matching objects list in return order
//Customer.OrderBy(c => c.LastName).ThenBy(c => c.FirstName) //Customer.OrderBy(c => c.LastName).ThenBy(c => c.FirstName)
var OrderedMatchingObjects = MatchingObjects.OrderBy(x => x.ObjectType).ThenByDescending(x => x.ObjectId); var OrderedMatchingObjects = MatchingObjects.OrderBy(x => x.ObjectType).ThenByDescending(x => x.ObjectId);

View File

@@ -38,11 +38,12 @@ namespace raven_integration
ApiResponse EventLogResponse = await Util.GetAsync($"EventLog/ObjectLog?AyType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdminFull")); ApiResponse EventLogResponse = await Util.GetAsync($"EventLog/ObjectLog?AyType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdminFull"));
Util.ValidateHTTPStatusCode(EventLogResponse, 200); Util.ValidateHTTPStatusCode(EventLogResponse, 200);
TODO: failing here, for no reason that makes any sense it thinks there are two created events by two users for the same widget. //NOTE:was failing here, for no reason that makes any sense it thinks there are two created events by two users for the same widget.
//might have been some temporary bad code in the seeder at one point when I was experimenting with async stuff
((JArray)EventLogResponse.ObjectResponse["result"]).Count.Should().Be(1);//only one event so far ((JArray)EventLogResponse.ObjectResponse["result"]).Count.Should().Be(1);//only one event so far
EventLogResponse.ObjectResponse["result"][0]["date"].Value<DateTime>().Should().BeLessThan(new TimeSpan(1, 0, 0)).Before(DateTime.UtcNow);//should be less than one hour before now EventLogResponse.ObjectResponse["result"][0]["date"].Value<DateTime>().Should().BeLessThan(new TimeSpan(1, 0, 0)).Before(DateTime.UtcNow);//should be less than one hour before now
EventLogResponse.ObjectResponse["result"][0]["userId"].Should().NotBeNull(); EventLogResponse.ObjectResponse["result"][0]["userId"].Should().NotBeNull();
EventLogResponse.ObjectResponse["result"][0]["event"].Value<int>().Should().Be(1);//AyEvent 1 = created EventLogResponse.ObjectResponse["result"][0]["event"].Value<int>().Should().Be(1);//AyEvent 1 = created
EventLogResponse.ObjectResponse["result"][0]["textra"].Should().BeNullOrEmpty(); EventLogResponse.ObjectResponse["result"][0]["textra"].Should().BeNullOrEmpty();

View File

@@ -449,6 +449,43 @@ namespace raven_integration
}//eot }//eot
[Fact]
public async void BigDataSearchShouldBeRelativelyFast()
{
//THIS test is a bit different in that it relies partly on the big dataset for testing
//so it has different paths depending upon if it's testing against the big data or not
const string TEST_SEARCH_PHRASE = "et*";
//Now see if can find those objects with a phrase search
dynamic SearchParameters = new JObject();
SearchParameters.phrase = TEST_SEARCH_PHRASE;
SearchParameters.nameOnly = false;
SearchParameters.typeOnly = 0;//no type
SearchParameters.maxResults = 1000;//default is 500
var watch = new System.Diagnostics.Stopwatch();
watch.Start();
ApiResponse a = await Util.PostAsync("Search", await Util.GetTokenAsync("manager", "l3tm3in"), SearchParameters.ToString());
watch.Stop();
var TimeToSearch = watch.ElapsedMilliseconds;
Util.ValidateDataReturnResponseOk(a);
//Now validate the return list
var ResultCount = ((JArray)a.ObjectResponse["result"]).Count;
//assert it's not unbounded
ResultCount.Should().BeLessOrEqualTo(1000);
//1755ms is the longest I've seen in initial testing so setting slightly above
TimeToSearch.Should().BeLessThan(1760, "Big data search should not be too slow");
}//eot
//================================================== //==================================================
}//eoc }//eoc