This commit is contained in:
2018-09-28 18:28:47 +00:00
parent 306d53d3d9
commit 1e3ccfcc14
2 changed files with 8 additions and 26 deletions

View File

@@ -46,8 +46,10 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Post search parameters
///
/// Required roles: Any
/// Required roles: Any
/// MaxResults defaults to 500
/// MaxResults = 0 returns all results
/// There is no paging as this is a dynamic response
///
/// </summary>
/// <param name="searchParams"></param>
@@ -69,29 +71,6 @@ namespace AyaNova.Api.Controllers
var SearchResults = await Search.DoSearch(ct, UserLocaleIdFromContext.Id(HttpContext.Items), UserRolesFromContext.Roles(HttpContext.Items), searchParams);
return Ok(new ApiOkResponse(SearchResults));
// if (o == null)
// {
// //error return
// return BadRequest(new ApiErrorResponse(biz.Errors));
// }
// else
// {
// //save to get Id
// await ct.SaveChangesAsync();
// //Log now that we have the Id
// EventLogProcessor.AddEntry(new Event(biz.userId, o.Id, AyaType.Widget, AyaEvent.Created), ct);
// await ct.SaveChangesAsync();
// //this will save the context as part of it's operations
// Search.ProcessNewObjectKeywords(ct, UserLocaleIdFromContext.Id(HttpContext.Items), o.Id, AyaType.Widget, o.Name, o.Notes, o.Name);
// //return success and link
// return CreatedAtAction("GetWidget", new { id = o.Id }, new ApiCreatedResponse(o));
// }
}

View File

@@ -22,6 +22,7 @@ namespace AyaNova.Biz
/*
ISSUES:
none at the moment
This is pretty fast so going to put a pin in it for now and if required later can sort it out.
*/
@@ -72,6 +73,7 @@ namespace AyaNova.Biz
public bool NameOnly { get; set; }
public AyaType TypeOnly { get; set; }
public List<long> Tags { get; set; }
//Note: maxresults of 0 will get all results
public int MaxResults { get; set; }
public SearchRequestParameters()
@@ -318,7 +320,8 @@ namespace AyaNova.Biz
//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();
if (searchParameters.MaxResults > 0)//0 = all results
MatchingObjects = MatchingObjects.Take(searchParameters.MaxResults).ToList();
//Sort and group the matching objects list in return order
//Customer.OrderBy(c => c.LastName).ThenBy(c => c.FirstName)