This commit is contained in:
@@ -29,84 +29,98 @@ namespace AyaNova.Biz
|
||||
|
||||
#region Search and return results
|
||||
|
||||
/*
|
||||
Requirements:
|
||||
/*
|
||||
Requirements:
|
||||
|
||||
INPUT PARAMETERS
|
||||
- Search phrase (with wildcard support)
|
||||
- Can be empty if tags are specified, no tags and no phrase is an error condition
|
||||
- ObjectType: only return results for objects of this type
|
||||
- InName: flag that indicates only search in names
|
||||
- Tag ids that are also on result objects
|
||||
- Can be empty if a phrase is specified
|
||||
INPUT PARAMETERS
|
||||
- Search phrase (with wildcard support)
|
||||
- Can be empty if tags are specified, no tags and no phrase is an error condition
|
||||
- ObjectType: only return results for objects of this type
|
||||
- InName: flag that indicates only search in names
|
||||
- Tag ids that are also on result objects
|
||||
- Can be empty if a phrase is specified
|
||||
|
||||
|
||||
ACTION
|
||||
Find search matches, then find tag matches then intersect, then sort and return
|
||||
Filter OUT results that user is not permitted to read
|
||||
//TODO: proper testing of searching
|
||||
- SAMPLE DATA: Need a huge amount of sample data indexed to load test it
|
||||
- INDEXES: play with it and see what works best
|
||||
ACTION
|
||||
Find search matches, then find tag matches then intersect, then sort and return
|
||||
Filter OUT results that user is not permitted to read
|
||||
//TODO: proper testing of searching
|
||||
- SAMPLE DATA: Need a huge amount of sample data indexed to load test it
|
||||
- INDEXES: play with it and see what works best
|
||||
|
||||
OUTPUT FORMAT
|
||||
- No localized text, up to client
|
||||
- Name of object in return result
|
||||
- Object Type and ID in return result
|
||||
- Group results by object type, then by object ID descending which will result in natural most recently created order
|
||||
OUTPUT FORMAT
|
||||
- No localized text, up to client
|
||||
- Name of object in return result
|
||||
- Object Type and ID in return result
|
||||
- Group results by object type, then by object ID descending which will result in natural most recently created order
|
||||
|
||||
result:[
|
||||
{
|
||||
name:"blah",
|
||||
type:2,
|
||||
id:210
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
*/
|
||||
|
||||
//Class to hold search request parameters
|
||||
public class SearchRequestParameter
|
||||
result:[
|
||||
{
|
||||
public string Phrase {get;set;}
|
||||
name:"blah",
|
||||
type:2,
|
||||
id:210
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
*/
|
||||
|
||||
//Class to hold search request parameters
|
||||
public class SearchRequestParameters
|
||||
{
|
||||
public string Phrase { get; set; }
|
||||
public bool NameOnly { get; set; }
|
||||
public AyaType TypeOnly {get;set;}
|
||||
public AyaType TypeOnly { get; set; }
|
||||
public List<long> Tags { get; set; }
|
||||
|
||||
public SearchRequestParameter()
|
||||
public SearchRequestParameters()
|
||||
{
|
||||
NameOnly = false;
|
||||
TypeOnly=AyaType.
|
||||
TypeOnly = AyaType.NoType;
|
||||
Tags = new List<long>();
|
||||
}
|
||||
|
||||
public bool IsValid
|
||||
{
|
||||
get
|
||||
{
|
||||
//has a phrase?
|
||||
if (!string.IsNullOrWhiteSpace(this.Phrase))
|
||||
return true;
|
||||
|
||||
//has tags?
|
||||
if (this.Tags.Count > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Class to hold search result
|
||||
public class SearchResult
|
||||
{
|
||||
public bool CJKIndex { get; set; }
|
||||
public List<string> StopWords { get; set; }
|
||||
public SearchResult()
|
||||
{
|
||||
CJKIndex = false;
|
||||
StopWords = new List<string>();
|
||||
}
|
||||
public string Name { get; set; }
|
||||
public AyaType Type { get; set; }
|
||||
public long Id { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static async Task<List<SearchResult>> DoSearch(AyContext ct, long localeId, long objectID, AyaType objectType, string name, params string[] text)
|
||||
public static async Task<List<SearchResult>> DoSearch(AyContext ct, SearchRequestParameters searchParameters)
|
||||
{
|
||||
List<SearchResult> ResultList=new List<SearchResult>();
|
||||
List<SearchResult> ResultList = new List<SearchResult>();
|
||||
|
||||
//fake await to clear error
|
||||
//await ct.SaveChangesAsync();
|
||||
//fake await to clear error
|
||||
//await ct.SaveChangesAsync();
|
||||
|
||||
return ResultList;
|
||||
return ResultList;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion dosearch
|
||||
|
||||
#region ProcessKeywords into Database
|
||||
|
||||
|
||||
Reference in New Issue
Block a user