Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents btnSearch As System.Web.UI.WebControls.Button
Protected WithEvents tbSearch As System.Web.UI.WebControls.TextBox
Protected WithEvents ddSearchType As System.Web.UI.WebControls.DropDownList
Protected WithEvents cbFuzzyness As System.Web.UI.WebControls.CheckBox
Protected WithEvents cbStemming As System.Web.UI.WebControls.CheckBox
Protected WithEvents srchResults As System.Web.UI.WebControls.Repeater
Protected WithEvents ddFuzzyness As System.Web.UI.WebControls.DropDownList
Protected WithEvents lnkAdvSearch As System.Web.UI.WebControls.LinkButton
Protected WithEvents pnlAdvSearch As System.Web.UI.WebControls.Panel
Protected WithEvents Literal1 As System.Web.UI.WebControls.Literal
Protected WithEvents lbViewHitHighlighted As System.Web.UI.WebControls.LinkButton
Protected WithEvents ddSort As System.Web.UI.WebControls.DropDownList
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Literal2 As System.Web.UI.WebControls.Literal
Protected WithEvents pnlSearchResults As System.Web.UI.WebControls.Panel
Protected WithEvents Literal3 As System.Web.UI.WebControls.Literal
Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
Protected WithEvents cbPhonic As System.Web.UI.WebControls.CheckBox
Protected WithEvents cbSynonyms As System.Web.UI.WebControls.CheckBox
Protected WithEvents chkSearchWithin As System.Web.UI.WebControls.CheckBox
Protected WithEvents pnlSearchWithin As System.Web.UI.WebControls.Panel
Protected WithEvents SearchResultList1 As SearchResultList.SearchResultList
Protected WithEvents ddAscendingFlag As System.Web.UI.WebControls.DropDownList
Protected WithEvents cbCaseInsensitive As System.Web.UI.WebControls.CheckBox
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
'Dim TheEngine As dtengine.Server
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Page.RegisterHiddenField("__EVENTTARGET", "Form1:btnSearch")
If Not IsPostBack() Then
pnlSearchWithin.Visible = False
End If
End Sub
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
GetResults()
pnlSearchWithin.Visible = True
End Sub
Private Sub GetResults()
SearchResultList1.IndexPath = ConfigurationSettings.AppSettings("indexPath")
Dim rptd As New SearchResultList.SearchResultList.ResultPathTranslationDictionary
rptd.Add("e:\ResultsListDemoFiles\Docs", "./files")
SearchResultList1.RelativePathTranslations = rptd
SearchResultList1.SortCaseInsensitive = cbCaseInsensitive.Checked
SearchResultList1.SortAscending() = ddAscendingFlag.SelectedValue
SearchResultList1.SearchType = ddSearchType.SelectedValue
SearchResultList1.SortType = ddSort.SelectedValue
SearchResultList1.Stemming = cbStemming.Checked
If cbFuzzyness.Checked = True Then
SearchResultList1.Fuzzy = True
SearchResultList1.FuzzLevel = ddFuzzyness.SelectedValue
Else
SearchResultList1.Fuzzy = False
End If
SearchResultList1.Phonic = cbPhonic.Checked
SearchResultList1.Synonyms = cbSynonyms.Checked
If chkSearchWithin.Checked = True Then
SearchResultList1.SearchWithin = True
SearchResultList1.PreviousSearchFilter = Session("psf")
End If
SearchResultList1.GetResults(tbSearch.Text) 'ONLY ONE LINE OF CODE
Session("psf") = SearchResultList1.PreviousSearchFilter
Literal1.Text = "Search: <B><I>" & tbSearch.Text & "</I></B> returned: " & _
CType(SearchResultList1.DataSource, DataTable).Rows.Count & " results"
End Sub
Private Sub lnkAdvSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkAdvSearch.Click
If pnlAdvSearch.Visible = False Then
pnlAdvSearch.Visible = True
lnkAdvSearch.Text = "Basic Search"
ElseIf pnlAdvSearch.Visible = True Then
ddSort.ClearSelection()
ddSort.Items.FindByValue("hits").Selected = True
cbFuzzyness.Checked = False
pnlAdvSearch.Visible = False
lnkAdvSearch.Text = "Advanced Search"
End If
End Sub
End Class