SystemIndex查询未检索即时添加的文件。可能吗? [英] SystemIndex query is not retrieving instantly added files. Is it possible?

查看:166
本文介绍了SystemIndex查询未检索即时添加的文件。可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查询SystemIndex catlog以显示我的应用程序中最近添加的文件。但有时候,SystemIndex并没有为我的搜索提供最近添加的文件。我们对这个问题有什么修正吗?



我的查询如下所示



SELECT系统。 ItemName,System.ItemFolderPathDisplayFROMSystemIndexWHERE CONTAINS(*,'searchterm',1033)AND(System.FileName LIKE'%。doc'或System.FileName LIKE'%。txt')AND Contains( System.Kind,'document')ORDER BY System.FileName ASC

解决方案

不幸的是,WMI在处理事件时既不高效也不可靠。正如我刚才所说,这样的处理只是基于定期轮询,这总是很糟糕。请参阅:

http://en.wikipedia.org/wiki/Pull_technology [< a href =http://en.wikipedia.org/wiki/Pull_technologytarget =_ blanktitle =New Window> ^ ],

http://en.wikipedia.org/wiki/Push_technology [ ^ ],

http://en.wikipedia.org/wiki/Polling_%28computer_science%29 [ ^ ]。



我的意思是,拉技术总是很糟糕(当谈到常规轮询时),推是好的。在您的情况下,当您查询文件时,它们可能当前未被轮询,您必须等待一段无限期的时间,所有文件都已完成,关闭,然后轮询。



替代品?您可以使用 System.IO.FileSystemWatcher

http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher%28v=vs.110%29.aspx [ ^ ]。



您应该注意一些事项:CodeProject成员约翰西蒙斯/非法程序员 报告了这些问题:

FileSystemWatcher - Pure Chaos(第1部分,共2部分) [ ^ ],

的一部分[ ^ ]。



-SA

I am querying SystemIndex catlog to show recently added files in my application. But sometimes, SystemIndex is not bring up the very recently added files for my search. Do we have any fix for this issue?

My Query is like below

SELECT "System.ItemName", "System.ItemFolderPathDisplay" FROM "SystemIndex" WHERE CONTAINS(*,'"searchterm"',1033) AND (System.FileName LIKE '%.doc' OR System.FileName LIKE '%.txt') AND Contains(System.Kind, 'document') ORDER BY System.FileName ASC

解决方案

Unfortunately, WMI is neither efficient nor reliable when it comes to handling its events. As I figured out a while ago, such handling is based simply on regular polling, which is always bad. Please see:
http://en.wikipedia.org/wiki/Pull_technology[^],
http://en.wikipedia.org/wiki/Push_technology[^],
http://en.wikipedia.org/wiki/Polling_%28computer_science%29[^].

I mean, pull technology is always bad (when it comes to regular polling), push is good. In your case, at the moment when you query for files, they might not be currently polled, you have to wait for some indefinite time, when all files are finalized, closed, and then polled.

Alternatives? You could use System.IO.FileSystemWatcher:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher%28v=vs.110%29.aspx[^].

There is something you should be aware of though: the CodeProject member John Simmons / outlaw programmer reported these problems:
FileSystemWatcher - Pure Chaos (Part 1 of 2)[^],
FileSystemWatcher - Pure Chaos (Part 2 of 2)[^].

—SA


这篇关于SystemIndex查询未检索即时添加的文件。可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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