lucene.net +仅搜索文件中的第一页 [英] lucene.net + search only first page in the file

查看:48
本文介绍了lucene.net +仅搜索文件中的第一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我只需要搜索文件的第一页.目前,我在WPF中使用lucene.net来创建索引和搜索文件的整个内容.我能够成功返回结果.现在,我只需要搜索文件的第一页,即每个文档都有一个标准形式,该形式将具有分配关键字的特定位置.所以有人可以在这个问题上为我提供指导吗!!!!!!!!!!!

如果您的数据是标准化的,则可以轻松地将第一页中的字段添加到索引中,然后进行搜索文件正文.

文档document =  Document();
文档.添加(Field.Text(" " )));
文档.添加(Field.Text(" " )));
indexWriter.addDocument(document); 


i have requirement where i need to search only the first page of the file. Currently i am using lucene.net with WPF for creating the indexes and searching the entire content of the file. i am able to return the results succefully. Now i need to search only the first page of the file i.e. Each document will have a standard proforma which will have a specific location where keywords are assigned. So can someone please guide me on this !!!

解决方案

If your data is standardized then you can easily add fields from the first page to your index and search that instead of the document body.

Document document = new Document();
document.add(Field.Text("invoicedate", "2012/1/1"));
document.add(Field.Text("invoiceno", "something"));
indexWriter.addDocument(document);


这篇关于lucene.net +仅搜索文件中的第一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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