如何从搜索结果中访问索引文件? [英] How to acess indexed files from search result?

查看:59
本文介绍了如何从搜索结果中访问索引文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在尝试使用Microsoft Indexing Services搜索存储在计算机中的网页.我能够将网页的路径(位于系统上)放入数据网格视图.

我想在网格视图中以超链接的形式显示网页的标题,并在单击超链接时将其重定向到系统中的网页.请帮帮我.

谢谢.

这是我为获取所搜索网页的路径而编写的代码.

Hi everyone, I am trying to search web-pages stored in my computer using Microsoft Indexing Services. I am able to get the paths of the webpages (which are on the system,) into a data grid view.

I want to display the title of the webpage in the gridview as a hyperlink and redirect to the the webpage in the system, when the hyperlink is clicked. Please help me.

Thank you.

Here is the code i have written to get the path of the searched webpages.

protected void Button1_Click(object sender, EventArgs e)
{
 string searchWord = TextBox1.Text;
 string catalogName = "sd";

 string connectionString = "Provider= \"MSIDXS\";Data Source=\""+catalogName+"\";

 string query = string.Format(@"SELECT Path FROM scope() WHERE FREETEXT(Contents, '"+searchWord+"')";
    
try
 {
    DataSet ds = new DataSet();
    OleDbDataAdapter da = new OleDbDataAdapter(query,connectionString);
    da.Fill(ds);
    GridView1.DataSource = ds;
    GridView1.DataBind();

 }
catch (Exception err)
 {
    Response.Write(err.Message);
           
 }
}
}

推荐答案

您必须设计gridview来执行相同的操作.分配数据源后,您需要映射诸如-超级链接列之类的列,并以路径作为链接和标题文本.

您发布的代码是从存储中获取路径.您需要获取网页标题,然后设计网格以获取所需的内容.

看一下示例:
http://www.cambiaresearch.com/c4/d85cf70a-072f-48f7-8d79-939d6ed1e514/Custom-HyperLink-Column-for-DataGrid.aspx [ http://www.dotnetspider.com/forum/146059-adding-hyperlink-datagrid- C.aspx [ ^ ]
You have to design the gridview to do the same. After assigning the datasource, you need to map the columns like - hyperlink column with path as link and title text.

The code that you have posted is of getting paths from a storage. You need to fetch the title of webpages and then design the grid to get what you want.

Have a look at the sample:
http://www.cambiaresearch.com/c4/d85cf70a-072f-48f7-8d79-939d6ed1e514/Custom-HyperLink-Column-for-DataGrid.aspx[^]

more info:
http://www.dotnetspider.com/forum/146059-adding-hyperlink-datagrid-C.aspx[^]


这篇关于如何从搜索结果中访问索引文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆