首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

从lucene中检索到的结果怎么与asp.net2003的DataGrid控件绑定

2012-01-02 
从lucene中检索到的结果如何与asp.net2003的DataGrid控件绑定以下是从lucene中检索的代码:StringKeywords

从lucene中检索到的结果如何与asp.net2003的DataGrid控件绑定
以下是从lucene中检索的代码:
String   Keywords=TextBox1.Text;     Keywords为查询的关键字
Hits   h   =   null;
Query   q   =   null;
IndexSearcher   s   =   new   IndexSearcher( "C:\\index ");   'index为lucene建立好的索引文件
q   =   QueryParser.Parse(Keywords, "AnchorText ",new   StandardAnalyzer());
h   =   s.Search(q);     'h为返回的结果集
if(h   !=null)
      {
if(h.Length()==0)
        Label1.Text= "No   result. ";
else
{  
                          Label1.Text= "Found   "+Keywords+ "in ";
        for(int   i=0;   i <h.Length();i++)
{
Document   doc   =   h.Doc(i);
string   f   =   doc.Get( "ID ");
                                                      Label1.Text=Label1.Text+ ", "+f;
}
}
    }
s.Close();
如何把索引的结果与asp.net2003的DataGrid控件绑定?

[解决办法]
DataGrid.DataSourse =
DataGrid.DataBind();
[解决办法]
Hits h = null;
看看这个hits是什么样的数据结构?
另外全文检索的结果集可能很大,不可能一次性绑定datagrid,可以考虑用google似的通过页面回发来分部载入.
[解决办法]
http://www.qiyesucha.com

热点排行