如何在lucene.net中搜索特定字段 [英] How to search a particular field in lucene.net
本文介绍了如何在lucene.net中搜索特定字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在进行结果搜索,而在中有很多字段和许多记录。现在我能够索引所有记录并搜索所有列和字段。我想只搜索特定的列或字段。你能帮我吗 out 。
解决方案
1。你在这里打开2个表格标签。
2.变量索引总是1.不知道为什么你有它。
Will这样的东西可以帮助你(根本不测试):
html.Append( < table style = \border-style:solid \>);
int fieldCount = reader.FieldCount;
html.Append( < thead>);
for ( int index = 0 ; index < fieldCount; index ++)
{
html.Append( < th> + reader.GetName(index)+ < /第> 中跨度>);
}
html.Append( < / thead>< tbody> ;跨度>);
while (reader.Read())
{
html.Append( < tr>);
for ( int index = 0 ; index < fieldCount; index ++)
{
html.Append( < td> + reader [index] .ToString()+ < / td>);
}
html.Append( < / tr>);
}
html.Append( < / tbody>< / table>< /跨度>);
I am doing result search and in that there are many fields and many records. Now i am able to index all the records and search all the columns and fields. I want to search only the particular column or field. Can you please help me out.
解决方案
1. You are opening 2 table tags here.
2. variable index will always be 1. Not sure why do you have it.
Will something like this help you (not tested at all):
html.Append("<table style=\"border-style:solid\">"); int fieldCount = reader.FieldCount; html.Append("<thead>"); for (int index = 0; index < fieldCount; index++) { html.Append("<th>" + reader.GetName(index) + "</th>"); } html.Append("</thead><tbody>"); while (reader.Read()) { html.Append("<tr>"); for (int index = 0; index < fieldCount; index++) { html.Append("<td>" + reader[index].ToString() + "</td>"); } html.Append("</tr>"); } html.Append("</tbody></table>");
这篇关于如何在lucene.net中搜索特定字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文