微软桌面搜索 - 包含在Windows Server 2008上的返回结果 [英] Microsoft Desktop Search - CONTAINS not returning results on windows server 2008

查看:176
本文介绍了微软桌面搜索 - 包含在Windows Server 2008上的返回结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图搜索远程文件共享(运行Windows Server 2008 R2)
为包含一些文本文件。如果我试试这个,它工作正常:

I am trying to search a remote fileshare (running windows server 2008 R2) for files that contain some text. If I try this, it works fine:

SELECT System.FileName
FROM RemoteServer.SystemIndex 
WHERE SCOPE='file://RemoteServer/FileShare'

和我得到很多的结果。但只要我尝试寻找一些文字我没有得到任何结果:

and I get lots of results. But as soon as I try to search for some text I get no results:

SELECT System.FileName
FROM RemoteServer.SystemIndex 
WHERE SCOPE='file://RemoteServer/FileShare'
AND CONTAINS('a')

如果我试试我的机器(Windows 7)中就可以正常工作:

if I try it on my machine (Windows 7) it works fine:

SELECT FileName
FROM SystemIndex 
WHERE CONTAINS('a')

下面是我的C#代码我使用搜索:

Here is my c# code that I'm using to search:

string connectionString = "Provider=Search.CollatorDSO;Extended Properties=\"Application=Windows\"";
using (OleDbConnection myOleDbConnection  = new OleDbConnection(connectionString))
{
    myOleDbConnection.Open();
    using (OleDbCommand myOleDbCommand  = new OleDbCommand(sql, myOleDbConnection))
    {
        using (myDataReader = myOleDbCommand.ExecuteReader())
        {
            if (!myDataReader.HasRows)
            {
                System.Console.WriteLine("Query returned 0 rows!");
            }
            else
            {
                // Process results here
            }
        }
    }
}

我曾尝试以下内容:


  • 重建索引

  • 选中该文件夹文件共享已在服务器上添加到索引

  • 选中文件类型选项卡,正确的扩展名被选中,而索引属性和文件内容选择为这些扩展

  • 重新启动索引服务

  • 重新启动服务器本身

  • Rebuilt the index
  • Checked that the folder "FileShare" has been added on the server to be indexed
  • Checked the "File Types" tab, that the correct extensions are ticked, and that "Index Properties and File Contents" is selected for those extensions
  • Restarted the indexing service
  • Restarted the server itself

无济于事。

任何其他建议?令人沮丧,因为我是那里的方式99%。这整个Windows桌面搜索似乎是相当支持的,也许我应该斌并使用别的东西吗?

Any other suggestions? Frustrating as I'm 99% of the way there. This whole windows desktop search seems to be pretty unsupported, maybe I should bin it and use something else?

推荐答案

尝试声明为nvarchar对于搜索词变量

Try declaring a nvarchar variable for the search word

定义@SearchWord为nvarchar(30)='A'

DECLARE @SearchWord nvarchar(30) = 'a'

然后修改代码:

选择文件名

这SystemIndex

FROM SystemIndex

WHERE CONTAINS(@SearchWord)

WHERE CONTAINS(@SearchWord)

此摘录来自于的TechNet CONTAINS 见的TechNet

This excerpt is from TechNet on CONTAINS See TechNet

* contains_search_condition *类型为nvarchar。当另一个字符数据类型用作输入的隐式转换时
。在以下
例如,@SearchWord变量,它被定义为varchar(30),
引起CONTAINS谓词的隐式转换。

*contains_search_condition* is nvarchar. An implicit conversion occurs when another character data type is used as input. In the following example, the @SearchWord variable, which is defined as varchar(30), causes an implicit conversion in the CONTAINS predicate.

这篇关于微软桌面搜索 - 包含在Windows Server 2008上的返回结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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