<% ' Initialize error handling Call InitializeErrorHandling("search.asp") theme = Request.Cookies("theme") IF theme = "" THEN theme="bg-theme1" END IF ' Get and validate search parameter search = Request.Querystring("search") search = Replace(search, "+", " ") search = Trim(search) ' Keep a display version with spaces for user-facing messages Dim searchDisplay searchDisplay = search ' Get highlight parameter for shared links Dim highlightId, isShared highlightId = Request.QueryString("highlight") isShared = (Request.QueryString("shared") = "1") ' Basic validation - prevent empty searches If search = "" Then Call HandleValidationError("default.asp", "REQUIRED_FIELD") End If ' Length validation - prevent excessively long inputs If Len(search) > 200 Then Call HandleValidationError("default.asp", "INVALID_INPUT") End If ' ------------------------------- Search For Machine Number or Hostname ---------------------------------------------------------- ' Also search by hostname for PCs, use pctypeid to determine PC vs Equipment strSQL = "SELECT m.machineid, m.hostname, m.pctypeid FROM machines m " & _ "WHERE (m.machinenumber = ? OR m.alias LIKE ? OR m.hostname = ?) AND m.isactive = 1" Set rs = ExecuteParameterizedQuery(objConn, strSQL, Array(search, "%" & search & "%", search)) If Not rs.EOF Then machineid = rs("machineid") Dim searchIsPC, searchRedirectPage ' PC if pctypeid IS NOT NULL searchIsPC = Not IsNull(rs("pctypeid")) rs.Close Set rs = Nothing Call CleanupResources() ' Route to appropriate detail page based on PC vs Equipment If searchIsPC Then Response.Redirect "./displaypc.asp?machineid=" & machineid Else Response.Redirect "./displaymachine.asp?machineid=" & machineid End If Response.End End If rs.Close Set rs = Nothing '----------------------------- Search for Applications directly ---------------------------------------------------------------- ' If only one application matches, redirect directly to it ' Normalize search by removing hyphens and underscores Dim normalizedSearch normalizedSearch = search normalizedSearch = Replace(normalizedSearch, "-", " ") normalizedSearch = Replace(normalizedSearch, "_", " ") normalizedSearch = Replace(normalizedSearch, " ", " ") ' Double spaces to single ' Search using REPLACE to normalize app names in the same way strSQL = "SELECT appid FROM applications WHERE " & _ "REPLACE(REPLACE(REPLACE(appname, '-', ' '), '_', ' '), ' ', ' ') LIKE ? " & _ "AND isactive = 1" Set rs = ExecuteParameterizedQuery(objConn, strSQL, Array("%" & normalizedSearch & "%")) Dim appMatchCount, firstAppId appMatchCount = 0 If Not rs.EOF Then firstAppId = rs("appid") appMatchCount = 1 rs.MoveNext If Not rs.EOF Then appMatchCount = 2 ' More than one match End If End If rs.Close Set rs = Nothing ' Disabled auto-redirect - always show results in search.asp for consistency ' If appMatchCount = 1 Then ' Call CleanupResources() ' Response.Redirect "./displaytopic.asp?appid=" & firstAppId ' Response.End ' End If search = Replace(search, " ", "+") '----------------------------- Search for CSF Printer Name ---------------------------------------------------------------- If (Left(LCase(search), 3)) = "csf" And Len(search) = 5 Then strSQL = "SELECT printerid FROM printers WHERE printercsfname = ?" Set rs = ExecuteParameterizedQuery(objConn, strSQL, Array(search)) If Not rs.EOF Then printerid = rs("printerid") rs.Close Set rs = Nothing Call CleanupResources() Response.Redirect "./displayprinter.asp?printerid=" & printerid Response.End End If rs.Close Set rs = Nothing End If '----------------------------- Search for Printer Serial Number (exact match) ---------------------------------------------------------------- strSQL = "SELECT printerid FROM printers WHERE serialnumber = ? AND isactive = 1" Set rs = ExecuteParameterizedQuery(objConn, strSQL, Array(search)) If Not rs.EOF Then printerid = rs("printerid") rs.Close Set rs = Nothing Call CleanupResources() Response.Redirect "./displayprinter.asp?printerid=" & printerid Response.End End If rs.Close Set rs = Nothing '----------------------------- Search for Printer FQDN (exact match) ---------------------------------------------------------------- strSQL = "SELECT printerid FROM printers WHERE fqdn = ? AND isactive = 1" Set rs = ExecuteParameterizedQuery(objConn, strSQL, Array(search)) If Not rs.EOF Then printerid = rs("printerid") rs.Close Set rs = Nothing Call CleanupResources() Response.Redirect "./displayprinter.asp?printerid=" & printerid Response.End End If rs.Close Set rs = Nothing '----------------------------------Is this an IP address ------------------------------------------------------------------------------------- ' Validate IP address format before query If ValidateIPAddress(search) Then strSQL = "SELECT subnetid FROM subnets WHERE subnets.isactive = 1 AND INET_ATON(?) >= ipstart AND INET_ATON(?) <= ipend" Set rs = ExecuteParameterizedQuery(objConn, strSQL, Array(search, search)) If Not rs.EOF Then subnetid = rs("subnetid") rs.Close Set rs = Nothing Call CleanupResources() Response.Redirect "./displaysubnet.asp?subnetid=" & subnetid & "&search=" & Server.URLEncode(search) Response.End End If rs.Close Set rs = Nothing End If ' ------------------------------- Is this an SSO redirect to displayprofile.asp ---------------------------------------------------------- If IsNumeric(search) And Len(search) = 9 Then Call CleanupResources() Response.Redirect "./displayprofile.asp?sso=" & search Response.End End If ' ----------------------------------Is this a SNOW ticket----------------------------------- If (Left(LCase(search), 5)) = "geinc" Then Call CleanupResources() Response.Write("") Response.End End If If (Left(LCase(search), 5)) = "gechg" Then Call CleanupResources() Response.Write("") Response.End End If If (Left(LCase(search), 5)) = "gerit" Then Call CleanupResources() Response.Write("") Response.End End If If (Left(LCase(search), 5)) = "gesct" Then Call CleanupResources() Response.Write("") Response.End End If %>
Search Results
<% ' Show educational banner if this is a shared link If isShared And search <> "" Then %>
Self-Service Tip This result was found by searching for "<%=Server.HTMLEncode(searchDisplay)%>".
<% End If %> <% ' --------------------------------- Search: Applications + KB Articles ----------------------------------------------------------- ' Query applications and KB articles separately, then combine and sort in ASP ' Use searchDisplay (which has spaces) for queries, search (with +) is for URLs Dim searchTerm searchTerm = searchDisplay ' First, get applications using FULLTEXT search for consistent relevance scoring Dim rsApps, appResults(), appCount appCount = 0 ' Use FULLTEXT search with MATCH...AGAINST in BOOLEAN MODE (same as KB articles) ' Uses same FULLTEXT search as KB articles for uniform relevance ranking ' NOTE: FULLTEXT has ft_min_word_len=4, so short words like "PC", "3", "of" won't match strSQL = "SELECT appid, appname, " & _ "MATCH (appname) AGAINST (? IN BOOLEAN MODE) AS relevance " & _ "FROM applications " & _ "WHERE MATCH (appname) AGAINST (? IN BOOLEAN MODE) " & _ " AND isactive = 1 " & _ "ORDER BY relevance DESC LIMIT 10" Set rsApps = ExecuteParameterizedQuery(objConn, strSQL, Array(searchTerm, searchTerm)) ' Store app results in array ReDim appResults(100, 3) ' [index, 0=type, 1=data, 2=relevance, 3=id] ' DEBUG: Output app count for troubleshooting Response.Write("") Do While Not rsApps.EOF And appCount < 10 ' DEBUG: Show each app found Response.Write("") appResults(appCount, 0) = "app" appResults(appCount, 1) = rsApps("appid") & "|" & rsApps("appname") ' Multiply by 10 to boost apps relative to KB articles (tunable) appResults(appCount, 2) = CDbl(rsApps("relevance")) * 10 appResults(appCount, 3) = rsApps("appid") appCount = appCount + 1 rsApps.MoveNext Loop rsApps.Close Set rsApps = Nothing ' DEBUG: Output final app count Response.Write("") ' Fallback: If FULLTEXT returned no results (common with short words < 4 chars), ' use LIKE-based search with pattern matching If appCount = 0 Then Response.Write("") strSQL = "SELECT appid, appname, " & _ "CASE " & _ " WHEN LOWER(appname) = LOWER(?) THEN 25 " & _ " WHEN LOWER(appname) LIKE CONCAT(LOWER(?), '%') THEN 20 " & _ " WHEN LOWER(appname) LIKE CONCAT('%', LOWER(?), '%') THEN 15 " & _ " ELSE 10 " & _ "END AS relevance " & _ "FROM applications " & _ "WHERE LOWER(appname) LIKE CONCAT('%', LOWER(?), '%') " & _ " AND isactive = 1 " & _ "ORDER BY relevance DESC LIMIT 10" Set rsApps = ExecuteParameterizedQuery(objConn, strSQL, Array(searchTerm, searchTerm, searchTerm, searchTerm)) Do While Not rsApps.EOF And appCount < 10 Response.Write("") appResults(appCount, 0) = "app" appResults(appCount, 1) = rsApps("appid") & "|" & rsApps("appname") appResults(appCount, 2) = CDbl(rsApps("relevance")) appResults(appCount, 3) = rsApps("appid") appCount = appCount + 1 rsApps.MoveNext Loop rsApps.Close Set rsApps = Nothing Response.Write("") End If ' Now get KB articles (removed linkURL from FULLTEXT search - no index exists) strSQL = "SELECT kb.linkid, kb.shortdescription, kb.linkurl, kb.clicks, app.appid, app.appname, " & _ "MATCH (kb.shortdescription) AGAINST (? IN BOOLEAN MODE) AS relevance1, " & _ "MATCH (kb.keywords) AGAINST (? IN BOOLEAN MODE) AS relevance2, " & _ "MATCH (app.appname) AGAINST (? IN BOOLEAN MODE) AS relevance3 " & _ "FROM knowledgebase kb " & _ "INNER JOIN applications app ON kb.appid = app.appid " & _ "WHERE kb.isactive = 1 " & _ "AND (MATCH (kb.shortdescription) AGAINST (? IN BOOLEAN MODE) > 0 " & _ " OR MATCH (kb.keywords) AGAINST (? IN BOOLEAN MODE) > 0) " & _ "ORDER BY (relevance3 * 3) + (relevance1 * 2) + (relevance2 * 2.5) + (kb.clicks * .1) DESC " & _ "LIMIT 20" Set rs = ExecuteParameterizedQuery(objConn, strSQL, Array(searchTerm, searchTerm, searchTerm, searchTerm, searchTerm)) ' Store KB results in same array Dim totalCount totalCount = appCount Do While Not rs.EOF And totalCount < 100 appResults(totalCount, 0) = "kb" appResults(totalCount, 1) = rs("linkid") & "|" & rs("appid") & "|" & rs("appname") & "|" & rs("shortdescription") & "|" & rs("linkurl") & "|" & rs("clicks") ' relevance3 = app.appname, relevance1 = description, relevance2 = keywords appResults(totalCount, 2) = (rs("relevance3") * 3) + (rs("relevance1") * 2) + (rs("relevance2") * 2.5) + (rs("clicks") * 0.1) appResults(totalCount, 3) = rs("linkid") totalCount = totalCount + 1 rs.MoveNext Loop rs.Close Set rs = Nothing ' Now get Notifications Dim rsNotif strSQL = "SELECT notificationid, notification, starttime, endtime, ticketnumber, link, " & _ "MATCH (notification) AGAINST (? IN BOOLEAN MODE) AS textrelevance, " & _ "CASE " & _ " WHEN NOW() BETWEEN starttime AND endtime THEN 3.0 " & _ " WHEN NOW() < starttime THEN 2.0 " & _ " WHEN DATEDIFF(NOW(), endtime) <= 7 THEN 1.5 " & _ " WHEN DATEDIFF(NOW(), endtime) <= 30 THEN 0.5 " & _ " ELSE 0.1 " & _ "END AS timefactor " & _ "FROM notifications " & _ "WHERE MATCH (notification) AGAINST (? IN BOOLEAN MODE) " & _ " AND isactive = 1 " & _ "ORDER BY (textrelevance * timefactor) DESC LIMIT 5" Set rsNotif = ExecuteParameterizedQuery(objConn, strSQL, Array(searchTerm, searchTerm)) ' DEBUG: Output notification count Response.Write("") Do While Not rsNotif.EOF And totalCount < 100 Dim finalNotifScore finalNotifScore = CDbl(rsNotif("textrelevance")) * CDbl(rsNotif("timefactor")) * 8 Response.Write("") appResults(totalCount, 0) = "notification" appResults(totalCount, 1) = rsNotif("notificationid") & "|" & rsNotif("notification") & "|" & rsNotif("starttime") & "|" & rsNotif("endtime") & "|" & rsNotif("ticketnumber") & "|" & rsNotif("link") ' Score = TextRelevance × TimeFactor × 8 (base multiplier) appResults(totalCount, 2) = finalNotifScore appResults(totalCount, 3) = rsNotif("notificationid") totalCount = totalCount + 1 rsNotif.MoveNext Loop rsNotif.Close Set rsNotif = Nothing ' Now get Machines (by machine number, alias, notes, machine type, or vendor) ' Also search by hostname for PCs ' Note: Join machinetypes directly to machines.machinetypeid (not through models) ' This ensures network devices show correct type (Firewall, Switch, etc.) instead of "Machine" Dim rsMachines strSQL = "SELECT m.machineid, m.machinenumber, m.alias, m.hostname, m.pctypeid, mt.machinetype " & _ "FROM machines m " & _ "LEFT JOIN machinetypes mt ON m.machinetypeid = mt.machinetypeid " & _ "LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " & _ "LEFT JOIN vendors v ON mo.vendorid = v.vendorid " & _ "WHERE (m.machinenumber LIKE ? OR m.alias LIKE ? OR m.machinenotes LIKE ? OR mt.machinetype LIKE ? OR v.vendor LIKE ? OR m.hostname LIKE ?) " & _ " AND m.isactive = 1 " & _ "LIMIT 10" Set rsMachines = ExecuteParameterizedQuery(objConn, strSQL, Array("%" & searchTerm & "%", "%" & searchTerm & "%", "%" & searchTerm & "%", "%" & searchTerm & "%", "%" & searchTerm & "%", "%" & searchTerm & "%")) Response.Write("") Do While Not rsMachines.EOF And totalCount < 100 ' Determine display text - use hostname for PCs, machinenumber for equipment ' PCs identified by pctypeid IS NOT NULL Dim isPC isPC = Not IsNull(rsMachines("pctypeid")) If isPC Then machineDispText = rsMachines("hostname") & "" If machineDispText = "" Then machineDispText = rsMachines("machinenumber") & "" Else machineDispText = rsMachines("machinenumber") & "" If Not IsNull(rsMachines("alias")) And rsMachines("alias") <> "" Then machineDispText = machineDispText & " (" & rsMachines("alias") & ")" End If End If Response.Write("") appResults(totalCount, 0) = "machine" ' Include isPC flag in data: machineid|machineDisplay|machinetype|isPC appResults(totalCount, 1) = rsMachines("machineid") & "|" & machineDispText & "|" & rsMachines("machinetype") & "|" & CStr(isPC) ' Score of 15 for machines (moderate priority) appResults(totalCount, 2) = 15 appResults(totalCount, 3) = rsMachines("machineid") totalCount = totalCount + 1 rsMachines.MoveNext Loop rsMachines.Close Set rsMachines = Nothing ' Now get Printers (by CSF name, Windows name, serial number, or model) Dim rsPrinters strSQL = "SELECT p.printerid, p.printercsfname, p.printerwindowsname, p.serialnumber, m.modelnumber " & _ "FROM printers p " & _ "LEFT JOIN models m ON p.modelid = m.modelnumberid " & _ "WHERE (p.printercsfname LIKE ? OR p.printerwindowsname LIKE ? OR p.serialnumber LIKE ? OR m.modelnumber LIKE ?) " & _ " AND p.isactive = 1 " & _ "LIMIT 10" Set rsPrinters = ExecuteParameterizedQuery(objConn, strSQL, Array("%" & searchTerm & "%", "%" & searchTerm & "%", "%" & searchTerm & "%", "%" & searchTerm & "%")) Response.Write("") Do While Not rsPrinters.EOF And totalCount < 100 printerDispText = rsPrinters("printercsfname") If Not IsNull(rsPrinters("printerwindowsname")) And rsPrinters("printerwindowsname") <> "" Then printerDispText = printerDispText & " - " & rsPrinters("printerwindowsname") End If Response.Write("") appResults(totalCount, 0) = "printer" appResults(totalCount, 1) = rsPrinters("printerid") & "|" & printerDispText & "|" & rsPrinters("modelnumber") & "|" & rsPrinters("serialnumber") ' Score of 15 for printers (moderate priority) appResults(totalCount, 2) = 15 appResults(totalCount, 3) = rsPrinters("printerid") totalCount = totalCount + 1 rsPrinters.MoveNext Loop rsPrinters.Close Set rsPrinters = Nothing ' Now get Employees (by first name, last name, or full name) ' Uses the employee database connection On Error Resume Next Dim empConn, empCmd, empRs Set empConn = Server.CreateObject("ADODB.Connection") empConn.ConnectionString = GetEmployeeConnectionString() empConn.Open If Err.Number = 0 Then Response.Write("") Set empCmd = Server.CreateObject("ADODB.Command") empCmd.ActiveConnection = empConn empCmd.CommandText = "SELECT SSO, First_Name, Last_Name, Team, Picture FROM employees " & _ "WHERE First_Name LIKE ? OR Last_Name LIKE ? " & _ "OR CONCAT(First_Name, ' ', Last_Name) LIKE ? " & _ "ORDER BY Last_Name, First_Name LIMIT 10" empCmd.CommandType = 1 Dim empSearchPattern empSearchPattern = "%" & searchTerm & "%" empCmd.Parameters.Append empCmd.CreateParameter("@first", 200, 1, 100, empSearchPattern) empCmd.Parameters.Append empCmd.CreateParameter("@last", 200, 1, 100, empSearchPattern) empCmd.Parameters.Append empCmd.CreateParameter("@full", 200, 1, 100, empSearchPattern) Set empRs = empCmd.Execute() If Err.Number = 0 Then Response.Write("") Do While Not empRs.EOF And totalCount < 100 Dim empSSO, empFirstName, empLastName, empTeam, empPicture, empFullName empSSO = empRs("SSO") & "" empFirstName = empRs("First_Name") & "" empLastName = empRs("Last_Name") & "" empTeam = empRs("Team") & "" empPicture = empRs("Picture") & "" empFullName = Trim(empFirstName & " " & empLastName) Response.Write("") appResults(totalCount, 0) = "employee" ' Format: sso|fullName|team|picture appResults(totalCount, 1) = empSSO & "|" & empFullName & "|" & empTeam & "|" & empPicture ' Score of 20 for employees (higher than machines/printers) appResults(totalCount, 2) = 20 appResults(totalCount, 3) = empSSO totalCount = totalCount + 1 empRs.MoveNext Loop empRs.Close Else Response.Write("") End If Set empRs = Nothing Set empCmd = Nothing empConn.Close Set empConn = Nothing Else Response.Write("") End If On Error Goto 0 ' Sort combined results by relevance (bubble sort is fine for small arrays) Dim i, j, tempType, tempData, tempRel, tempId For i = 0 To totalCount - 1 For j = i + 1 To totalCount - 1 If appResults(j, 2) > appResults(i, 2) Then ' Swap tempType = appResults(i, 0) tempData = appResults(i, 1) tempRel = appResults(i, 2) tempId = appResults(i, 3) appResults(i, 0) = appResults(j, 0) appResults(i, 1) = appResults(j, 1) appResults(i, 2) = appResults(j, 2) appResults(i, 3) = appResults(j, 3) appResults(j, 0) = tempType appResults(j, 1) = tempData appResults(j, 2) = tempRel appResults(j, 3) = tempId End If Next Next %> <% ' Display combined and sorted results from array Dim cleanSearch cleanSearch = Replace(searchDisplay, "+", " ") If totalCount > 0 Then Dim k, resultType, relevanceScore, badgeClass, rowStyle, rowId Dim dataFields, appid, appname, linkid, shortdesc, linkurl, clicks Dim notifId, notifText, notifStart, notifEnd, notifTicket, notifLink, notifDisplay Dim machineId, machineDispText, machineType Dim printerId, printerDispText, printerModel, printerSerial, printerDetailText For k = 0 To totalCount - 1 resultType = appResults(k, 0) relevanceScore = CDbl(appResults(k, 2)) ' Determine badge color based on score If relevanceScore >= 200 Then badgeClass = "badge-success" ElseIf relevanceScore >= 100 Then badgeClass = "badge-primary" ElseIf relevanceScore >= 50 Then badgeClass = "badge-warning" Else badgeClass = "badge-secondary" End If ' Parse data based on result type dataFields = Split(appResults(k, 1), "|") If resultType = "app" Then ' App format: appid|appname appid = dataFields(0) appname = dataFields(1) rowId = "app-result-" & appid If highlightId <> "" And CStr(appid) = CStr(highlightId) And Request.QueryString("type") = "app" Then rowStyle = " class='highlighted-result'" Else rowStyle = "" End If Response.Write("") ' Column 1: Empty for apps Response.Write("") ' Column 2: App name with icon (matches sidebar) Response.Write("") ' Column 3: View details link Response.Write("") ' Column 4: Relevance badge Response.Write("") ' Column 5: Share button Response.Write("") ElseIf resultType = "kb" Then ' KB format: linkid|appid|appname|shortdescription|linkurl|clicks linkid = dataFields(0) appid = dataFields(1) appname = dataFields(2) shortdesc = dataFields(3) linkurl = dataFields(4) clicks = dataFields(5) rowId = "result-" & linkid If highlightId <> "" And CStr(linkid) = CStr(highlightId) And Request.QueryString("type") <> "app" Then rowStyle = " class='highlighted-result'" Else rowStyle = "" End If Response.Write("") ' Column 1: Edit icon Response.Write("") ' Column 2: App name with KB icon (matches sidebar) Response.Write("") ' Column 3: Description Response.Write("") ' Column 4: Relevance badge Response.Write("") ' Column 5: Share button Response.Write("") ElseIf resultType = "notification" Then ' Notification format: notificationid|notification|starttime|endtime|ticketnumber|link notifId = dataFields(0) notifText = dataFields(1) notifStart = dataFields(2) notifEnd = dataFields(3) notifTicket = dataFields(4) notifLink = dataFields(5) rowId = "notification-result-" & notifId If highlightId <> "" And CStr(notifId) = CStr(highlightId) And Request.QueryString("type") = "notification" Then rowStyle = " class='highlighted-result'" Else rowStyle = "" End If Response.Write("") ' Column 1: Empty for notifications Response.Write("") ' Column 2: Notification icon - link to notifications page (matches KB article pattern) Response.Write("") ' Column 3: Notification text links to edit (like clicking event in calendar) notifDisplay = Server.HTMLEncode(notifText) If notifTicket <> "" Then notifDisplay = notifDisplay & " " & Server.HTMLEncode(notifTicket) & "" End If Response.Write("") ' Column 4: Relevance badge Response.Write("") ' Column 5: Share button Response.Write("") ElseIf resultType = "machine" Then ' Machine format: machineid|machineDisplay|machinetype|isPC machineId = dataFields(0) machineDispText = dataFields(1) machineType = dataFields(2) Dim machineIsPC, machineDetailPage, machineListPage, machineIcon, machineIconColor, machineLabel machineIsPC = (UBound(dataFields) >= 3 And dataFields(3) = "True") ' Set page, icon, label and filter data-type based on PC vs Equipment vs Network Device Dim machineDataType If machineIsPC Then machineDetailPage = "displaypc.asp" machineListPage = "displaypcs.asp" machineIcon = "zmdi-desktop-windows" machineIconColor = "text-primary" machineLabel = "PC" machineDataType = "pc" Else machineDetailPage = "displaymachine.asp" machineListPage = "displaymachines.asp" ' Use actual machine type from database for label (Server, Switch, etc.) ' Fall back to "Machine" if not available If Not IsNull(machineType) And machineType <> "" Then machineLabel = machineType Else machineLabel = "Machine" End If ' Set icon and data-type based on machine type Select Case LCase(machineLabel) Case "server" machineIcon = "zmdi-dns" machineIconColor = "text-danger" machineDataType = "server" Case "switch" machineIcon = "zmdi-device-hub" machineIconColor = "text-info" machineDataType = "switch" Case "access point" machineIcon = "zmdi-wifi" machineIconColor = "text-success" machineDataType = "accesspoint" Case "firewall" machineIcon = "zmdi-shield-security" machineIconColor = "text-warning" machineDataType = "equipment" Case "idf" machineIcon = "zmdi-input-composite" machineIconColor = "text-secondary" machineDataType = "equipment" Case "camera" machineIcon = "zmdi-videocam" machineIconColor = "text-primary" machineDataType = "equipment" Case Else machineIcon = "zmdi-reader" machineIconColor = "text-warning" machineDataType = "equipment" End Select End If rowId = "machine-result-" & machineId If highlightId <> "" And CStr(machineId) = CStr(highlightId) And Request.QueryString("type") = "machine" Then rowStyle = " class='highlighted-result'" Else rowStyle = "" End If Response.Write("") ' Column 1: Empty for machines Response.Write("") ' Column 2: Machine/PC icon - link to appropriate list page (matches sidebar) Response.Write("") ' Column 3: Machine number/alias or hostname links to appropriate detail page Response.Write("") ' Column 4: Relevance badge Response.Write("") ' Column 5: Share button Response.Write("") ElseIf resultType = "printer" Then ' Printer format: printerid|printerDisplay|modelnumber|serialnumber printerId = dataFields(0) printerDispText = dataFields(1) printerModel = dataFields(2) printerSerial = dataFields(3) rowId = "printer-result-" & printerId If highlightId <> "" And CStr(printerId) = CStr(highlightId) And Request.QueryString("type") = "printer" Then rowStyle = " class='highlighted-result'" Else rowStyle = "" End If Response.Write("") ' Column 1: Empty for printers Response.Write("") ' Column 2: Printer icon - link to printers page (matches sidebar) Response.Write("") ' Column 3: Printer name links to printer detail printerDetailText = Server.HTMLEncode(printerDispText) If Not IsNull(printerModel) And printerModel <> "" Then printerDetailText = printerDetailText & " " & Server.HTMLEncode(printerModel) & "" End If Response.Write("") ' Column 4: Relevance badge Response.Write("") ' Column 5: Share button Response.Write("") ElseIf resultType = "employee" Then ' Employee format: sso|fullName|team|picture Dim employeeSSO, employeeFullName, employeeTeam, employeePicture employeeSSO = dataFields(0) employeeFullName = dataFields(1) If UBound(dataFields) >= 2 Then employeeTeam = dataFields(2) Else employeeTeam = "" If UBound(dataFields) >= 3 Then employeePicture = dataFields(3) Else employeePicture = "" rowId = "employee-result-" & employeeSSO If highlightId <> "" And CStr(employeeSSO) = CStr(highlightId) And Request.QueryString("type") = "employee" Then rowStyle = " class='highlighted-result'" Else rowStyle = "" End If Response.Write("") ' Column 1: Empty for employees Response.Write("") ' Column 2: Employee icon Response.Write("") ' Column 3: Employee name links to profile Response.Write("") ' Column 4: Relevance badge Response.Write("") ' Column 5: Share button Response.Write("") End If Response.Write("") Next End If Call CleanupResources() %>
Topic Description Relevance
 " & Server.HTMLEncode(appname) & "View Application Details " & FormatNumber(relevanceScore, 1) & "
" & Server.HTMLEncode(appname) & "" & Server.HTMLEncode(shortdesc) & " " & FormatNumber(relevanceScore, 1) & "
 Notification" & notifDisplay & " " & FormatNumber(relevanceScore, 1) & "
 " & machineLabel & "" & Server.HTMLEncode(machineDispText) & " " & Server.HTMLEncode(machineType) & " " & FormatNumber(relevanceScore, 1) & "
 Printer" & printerDetailText & " " & FormatNumber(relevanceScore, 1) & "
 Employee" & Server.HTMLEncode(employeeFullName)) If employeeTeam <> "" Then Response.Write(" " & Server.HTMLEncode(employeeTeam) & "") End If Response.Write(" " & FormatNumber(relevanceScore, 1) & "
Link Copied! This link will show the search term and highlight the result