Zooflow: Search
This commit is contained in:
@@ -59,13 +59,15 @@ Public Class SearchRunner
|
||||
|
||||
Private ReadOnly Environment As Environment
|
||||
Private ReadOnly SearchTitle As String
|
||||
Public ReadOnly Property UserId As Integer
|
||||
Private ReadOnly UserId As Integer
|
||||
Private ReadOnly UserLanguage As String
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pEnvironment As Environment, pSearchTitle As String)
|
||||
MyBase.New(pLogConfig)
|
||||
Environment = pEnvironment
|
||||
SearchTitle = pSearchTitle
|
||||
UserId = My.Application.User.UserId
|
||||
UserLanguage = My.Application.User.Language
|
||||
End Sub
|
||||
|
||||
Public Function RunWithDataTable(pDatatable As DataTable) As SearchResult
|
||||
@@ -106,17 +108,25 @@ Public Class SearchRunner
|
||||
Return Await RunWithSearchTerm(pSearchTerm, pDateFrom, pDateTo, Nothing, Nothing)
|
||||
End Function
|
||||
|
||||
Public Async Function RunWithSearchTerm(pSearchTerm As String, pDateFrom As Date, pDateTo As Date, pSearchTokens As IEnumerable(Of Search.SearchToken.AttributeValueToken), pSearchTitle As String) As Task(Of SearchResult)
|
||||
Public Async Function RunWithSearchTerm(pSearchTerm As String, pDateFrom As Date, pDateTo As Date, pSearchTokens As IEnumerable(Of Search.SearchToken.Token), pSearchTitle As String) As Task(Of SearchResult)
|
||||
Dim oWindowTitle = GetResultWindowString(pSearchTerm, pSearchTitle)
|
||||
Dim oParams = GetParams(oWindowTitle)
|
||||
Dim oDateConstraint = GetDateConstraint(pDateFrom, pDateTo)
|
||||
Dim oDateConstraint = Await GetDateConstraint(pDateFrom, pDateTo)
|
||||
|
||||
Await InsertSearchTokens(pSearchTokens)
|
||||
|
||||
Dim oSQL = $"EXEC PRIDB_SEARCH_TEXT_GET_RESULTS {UserId},'{pSearchTerm}','{oDateConstraint}'"
|
||||
Dim oSQL = $"EXEC PRIDB_SEARCH_GET_TEXT_RESULTS {UserId},'{pSearchTerm}','{oDateConstraint}', '{UserLanguage}'"
|
||||
If pSearchTokens IsNot Nothing AndAlso pSearchTokens.Count > 0 Then
|
||||
oSQL = $"EXEC PRIDB_SEARCH_GET_TOKEN_RESULT_DOCS {UserId}, '{oDateConstraint}', '{UserLanguage}'"
|
||||
End If
|
||||
|
||||
If Await My.Database.ExecuteNonQueryIDBAsync(oSQL) = True Then
|
||||
Dim oDTDocResult = Await My.Database.GetDatatableIDBAsync(BaseSearchSQL)
|
||||
|
||||
If oDTDocResult Is Nothing Then
|
||||
Return New SearchResult("Error in Search Query")
|
||||
End If
|
||||
|
||||
Dim oRowCount = oDTDocResult.Rows.Count
|
||||
If oRowCount > 0 Then
|
||||
oParams.Results.Add(New DocumentResultList.DocumentResult() With {
|
||||
@@ -142,7 +152,7 @@ Public Class SearchRunner
|
||||
|
||||
End If
|
||||
Else
|
||||
Return New SearchResult("Error in FlowSearch - Check Your log")
|
||||
Return New SearchResult("Error in Search Function")
|
||||
|
||||
End If
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user