当我试图使用FulltextSqlQuery谓词来筛选技能管理属性上的用户结果时,我遇到了MOSS的问题。让我示范一下:
没有过滤器的查询返回预期结果:
SELECT AccountName, Skills
from scope()
where freetext(defaultproperties,'+Bob')
And ("scope" = 'People')结果
Total Rows: 1
ACCOUNTNAME: MYDOMAIN\Bob
SKILLS: Numchucks | ASP.Net | Application Architecture但是,当我追加一个包含谓词时,我将不再获得预期的结果:
SELECT AccountName, Skills
from scope()
where freetext(defaultproperties,'+Bob')
And ("scope" = 'People')
And (CONTAINS(Skills, 'Numchucks'))结果
Total Rows: 0我确实意识到我可以使用一些数组谓词来完成这个任务,但是我想知道为什么它不能使用用于技能属性的Content谓词。我已经成功地使用了带有自定义爬行属性的Content谓词,该属性被表示为“多值”。在SSP管理站点中的爬行属性页面中,SSP属性(虽然它似乎是多值的)没有这样表示:
layouts/schema.aspx?ConsoleView=crawledPropertiesView&category=People
有人有什么想法吗?
发布于 2010-03-04 15:16:25
因此,在Mark (Microsoft SharePoint Developer Support)的帮助下,通过将ManagedProperty属性设置为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-02-22 03:19:27
SELECT AccountName, Skills
from scope()
where freetext(defaultproperties,'+Bob')
And ("scope" = 'People')
And (CONTAINS(Skills, 'Numchucks*'))最后使用*。
您还可以尝试更多的选项:
下面的列表标识了使用FullTextSqlQuery类只支持search语法的其他查询元素: FREETEXT() 包含() 喜欢
https://stackoverflow.com/questions/2293066
复制相似问题