savvas stampolloglou
2007-03-18 15:45:27 UTC
Hello to all after having read a lot if stuff about indexing server i
decided to build an app using it.
I wanted to start from something simle and then add more stuff to it
so I made the application below.
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<Script Runat="Server">
Sub Button_Click( s As Object, e As EventArgs )
Dim databaseCon As OleDbConnection
Dim queryString As String
Dim cmdSearch As OleDbCommand
Dim dtrSearch As OleDbDataReader
DatabaseCon = New OleDbConnection( "Provider=MSIDXS;Data
Source=Web" )
query = "SELECT RANK, FileName, VPath, Characterization " & _
"FROM SCOPE() " & _
"WHERE CONTAINS( '" & txtSearchPhrase.Text & "') " & _
"ORDER BY RANK DESC"
cmdSearch = New OleDbCommand( strSearch, DatabaseCon )
DatabaseCon.Open()
Try
dtrSearch = cmdSearch.ExecuteReader()
lblResults.Text = "<ul>"
While dtrSearch.Read
lblResults.Text &= "<li> (" & dtrSearch( "RANK" ) / 10 & "%) "
lblResults.Text &= "<a href=""" &
dtrSearch( "VPath" ).ToString()
lblResults.Text &= """>"
lblResults.Text &= dtrSearch( "FileName" ) & "</a><br>"
lblResults.Text &= dtrSearch( "Characterization" )
lblResults.Text &= "<p>"
End While
Catch exc As Exception
lblResults.Text = "Den vrethikan apotelesmata"
End Try
DatabaseCon.Close()
End Sub
</Script>
<html>
<head><title>FileContains.aspx</title></head>
<body>
<form Runat="Server">
<h2>Indexing service boolean search:</h2>
<asp:TextBox
ID="txtSearchPhrase"
Columns="50"
Runat="Server" />
<asp:Button
Text="Search!"
OnClick="Button_Click"
Runat="Server" />
<hr>
<asp:Label
ID="lblResults"
EnableViewState="False"
Width="400px"
Runat="Server" />
</form>
</body>
</html>
when i run it everything is except that lblResults.Text &= "<a
href=""" & dtrSearch( "VPath" ).ToString()
lblResults.Text &= """>" doens't work. when I put the mouse over
the created link for each file i get only a link to my search page
instead of the path.
For example if the returned document is located on c:\word.doc when i
click on the lick I go back to the default.aspx. Can anyone help??
Thanks in advance!!
decided to build an app using it.
I wanted to start from something simle and then add more stuff to it
so I made the application below.
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<Script Runat="Server">
Sub Button_Click( s As Object, e As EventArgs )
Dim databaseCon As OleDbConnection
Dim queryString As String
Dim cmdSearch As OleDbCommand
Dim dtrSearch As OleDbDataReader
DatabaseCon = New OleDbConnection( "Provider=MSIDXS;Data
Source=Web" )
query = "SELECT RANK, FileName, VPath, Characterization " & _
"FROM SCOPE() " & _
"WHERE CONTAINS( '" & txtSearchPhrase.Text & "') " & _
"ORDER BY RANK DESC"
cmdSearch = New OleDbCommand( strSearch, DatabaseCon )
DatabaseCon.Open()
Try
dtrSearch = cmdSearch.ExecuteReader()
lblResults.Text = "<ul>"
While dtrSearch.Read
lblResults.Text &= "<li> (" & dtrSearch( "RANK" ) / 10 & "%) "
lblResults.Text &= "<a href=""" &
dtrSearch( "VPath" ).ToString()
lblResults.Text &= """>"
lblResults.Text &= dtrSearch( "FileName" ) & "</a><br>"
lblResults.Text &= dtrSearch( "Characterization" )
lblResults.Text &= "<p>"
End While
Catch exc As Exception
lblResults.Text = "Den vrethikan apotelesmata"
End Try
DatabaseCon.Close()
End Sub
</Script>
<html>
<head><title>FileContains.aspx</title></head>
<body>
<form Runat="Server">
<h2>Indexing service boolean search:</h2>
<asp:TextBox
ID="txtSearchPhrase"
Columns="50"
Runat="Server" />
<asp:Button
Text="Search!"
OnClick="Button_Click"
Runat="Server" />
<hr>
<asp:Label
ID="lblResults"
EnableViewState="False"
Width="400px"
Runat="Server" />
</form>
</body>
</html>
when i run it everything is except that lblResults.Text &= "<a
href=""" & dtrSearch( "VPath" ).ToString()
lblResults.Text &= """>" doens't work. when I put the mouse over
the created link for each file i get only a link to my search page
instead of the path.
For example if the returned document is located on c:\word.doc when i
click on the lick I go back to the default.aspx. Can anyone help??
Thanks in advance!!