I'm developing a Desktop Search Engine in VB 9 using Lucene.NET
我正在使用Lucene.NET在VB 9中开发桌面搜索引擎
I wish to delete and create a new entry for a file that is updated.
我希望删除并为更新的文件创建一个新条目。
The Index stores complete file path and the last modified date.
索引存储完整的文件路径和上次修改日期。
doc.Add(New Field("path", filepath, Field.Store.YES, Field.Index.UN_TOKENIZED))
doc.Add(New Field("modified", New FileInfo(filepath).LastWriteTime, Field.Store.YES, Field.Index.UN_TOKENIZED))
.
.
I'm using the IndexReader to check if a file is present in the Index (to avoid re-indexing the same files).
我正在使用IndexReader来检查索引中是否存在文件(以避免重新索引相同的文件)。
Dim reader As IndexReader = IndexReader.Open(SearchForm.IndexFolderTextBox.Text)
If reader.DocFreq(New Term("path", filepath)) = 0 Then
addFile(filepath)
End If
reader.Close()
I have the following doubts:
我有以下疑惑:
-
How do I use the value in the
modified
field to check if the Index entry for a particular file is old? What function of IndexReader will allow me to do this?如何使用修改字段中的值来检查特定文件的索引条目是否旧? IndexReader的哪些功能可以让我这样做?
-
How do I get the document number (docNum) for the function deleteDocument()
如何获取函数deleteDocument()的文档编号(docNum)
1 个解决方案
#1
To answer your second questions, use the following IndexReader method:
要回答第二个问题,请使用以下IndexReader方法:
public int deleteDocuments(Term term)
so you won't need the document number.
所以你不需要文件号码。
#1
To answer your second questions, use the following IndexReader method:
要回答第二个问题,请使用以下IndexReader方法:
public int deleteDocuments(Term term)
so you won't need the document number.
所以你不需要文件号码。