This commit is contained in:
@@ -66,38 +66,50 @@ result:[
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Class to hold search request parameters
|
//Class to hold search request parameters
|
||||||
public class SearchRequestParameter
|
public class SearchRequestParameters
|
||||||
{
|
{
|
||||||
public string Phrase { get; set; }
|
public string Phrase { get; set; }
|
||||||
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 SearchRequestParameter()
|
public SearchRequestParameters()
|
||||||
{
|
{
|
||||||
NameOnly = false;
|
NameOnly = false;
|
||||||
TypeOnly=AyaType.
|
TypeOnly = AyaType.NoType;
|
||||||
Tags = new List<long>();
|
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
|
//Class to hold search result
|
||||||
public class SearchResult
|
public class SearchResult
|
||||||
{
|
{
|
||||||
public bool CJKIndex { get; set; }
|
public string Name { get; set; }
|
||||||
public List<string> StopWords { get; set; }
|
public AyaType Type { get; set; }
|
||||||
public SearchResult()
|
public long Id { get; set; }
|
||||||
{
|
|
||||||
CJKIndex = false;
|
|
||||||
StopWords = new List<string>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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>();
|
||||||
|
|
||||||
@@ -106,7 +118,9 @@ result:[
|
|||||||
|
|
||||||
return ResultList;
|
return ResultList;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
#endregion dosearch
|
||||||
|
|
||||||
#region ProcessKeywords into Database
|
#region ProcessKeywords into Database
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user