3

尝试使用 CONTAINS 谓词过滤 Skills Managed Property 上的 People 结果时,我遇到了 MOSS FulltextSqlQuery 问题。让我演示一下:

没有过滤器的查询返回预期结果:

SELECT AccountName, Skills
from scope()
where freetext(defaultproperties,'+Bob')
And ("scope" = 'People')

结果

Total Rows: 1
ACCOUNTNAME: MYDOMAIN\Bob
SKILLS: Numchucks | ASP.Net | Application Architecture

但是当我附加一个 CONTAINS 谓词时,我不再得到预期的结果:

SELECT AccountName, Skills
from scope()
where freetext(defaultproperties,'+Bob')
And ("scope" = 'People')
And (CONTAINS(Skills, 'Numchucks'))

结果

Total Rows: 0

我确实意识到我可以使用 SOME ARRAY 谓词来完成此操作,但我想知道为什么这不适用于 Skills 属性的 CONTAINS 谓词。我已成功使用 CONTAINS 谓词和自定义爬网属性,该属性指示为“多值”。Skills 属性(尽管它似乎是多值的)在 SSP 管理站点的 Crawled Properties 页面上没有这样显示:

http:///ssp/admin/_layouts/schema.aspx?ConsoleView=crawledPropertiesView&category=People

有人有想法么?

4

2 回答 2

2

因此,在 Mark Cameron(Microsoft SharePoint 开发人员支持)的帮助下,我发现必须通过将 FullTextQueriable 属性设置为 true,使用 ManagedProperty 对象模型 API启用某些托管属性以进行全文搜索。以下是为我解决此问题的方法。它可以包含在控制台应用程序中或作为农场或 Web 应用程序范围的功能接收器。

    using Microsoft.Office.Server;
    using Microsoft.Office.Server.Search.Administration;

    private void EnsureFullTextQueriableManagedProperties(ServerContext serverContext)
    {
        var schema = new Schema(SearchContext.GetContext(serverContext));
        var managedProperties = new[] { "SKILLS", "INTERESTS" };
        foreach (ManagedProperty managedProperty in schema.AllManagedProperties)
        {
            if (!managedProperties.Contains(managedProperty.Name.ToUpper()))
                continue;

            if (managedProperty.FullTextQueriable)
                continue;

            try
            {
                managedProperty.FullTextQueriable = true;
                managedProperty.Update();
                Log.Info(m => m("Successfully set managed property {0} to be FullTextQueriable", managedProperty.Name));
            }
            catch (Exception e)
            {
                Log.Error(m => m("Error updating managed property {0}", managedProperty.Name), e);
            }
        }
    }
于 2010-03-04T15:16:25.457 回答
0
SELECT AccountName, Skills
from scope()
where freetext(defaultproperties,'+Bob')
And ("scope" = 'People')
And (CONTAINS(Skills, 'Numchucks*'))

最后使用 *。

您还可以尝试更多选择:

以下列表标识了仅使用 FullTextSqlQuery 类的 SQL 搜索语法支持的其他查询元素:

自由文本()

包含()

来源

于 2010-02-22T03:19:27.283 回答