我们正在使用新的横向于网站发布和搜索功能在SharePoint 2013上构建一个网站。我们希望使用串联中的内容搜索Web部分来实现“相关项目”功能,其中包含跨所有页面内容类型存在的托管元数据字段。因此,可以用“位置”字段标记内容(目录项)以描述内容项的地理相关性。 如果我们有使用内容搜索Web部件(和内容重用Web部件)的目录项页面来显示主页信息,那么可以将另一个内容搜索Web部件添加到使用数据的页面主要查询(即位置字段的内容)运行另一个搜索以拉回符合相同位置的所有其他内容。在我们的上下文中,位置字段允许多个值,理想情况下,它也能够匹配多个项目。

我知道这是可以使用内容查询Web部分的单值元数据字段,但是在内容搜索Web部件中复制了此功能吗?

我可以看到您可以在标记上匹配,但它依赖于您的硬编码到Web部件中的值,我们希望它基于页面上的其他值是动态的。我也可以看到,您可以使用“当前页面”的“字段”值作为内容搜索Web部件中的属性过滤器。我的理解是从搜索中拉出的物品不是“页面上的字段”。

是否有人知道如何使用SharePoint 2013搜索功能实现此功能?或提供与此过程的文档的任何链接?

谢谢。

有帮助吗?

解决方案

I've found a way to accomplish this given a situation where the managed property value I need to make the secondary/related CSWP lookup happens to be exposed in the URL of the primary catalog item.

I.e., a People Catalog with a catalog item URL of (/directory/Last, First) --- I want to show activities related to that person (from an Activities Catalog at /activities/Activity Title) on the person's catalog item page.

So in the Activities Catalog I created a site column 'Credit' and populated it with values of 'Last, First' - then on the People Catalog individual item page I went into edit mode, added a CSWP, and leveraged the "value of a token from URL" advanced query parameter to search the Activities list:

(contentclass:sts_listitem OR IsDocument:True) SPSiteUrl:http://authsite.organization.com ListId:6b291282-99e7-4d97-a5ff-activitieslistGUID CreditOWSTEXT:{URLToken.1}

I have not yet found a way to directly pass a value retrieved from one CSWP to another CSWP as a query filter parameter, though my brain sort of expects that capability to be there somewhere, and it might just be a case of my overlooking something obvious or under-documented (or maybe just my glazing over while reading documentation.)

I also have not yet found a good way to work this relationship in reverse. In other words, the Activities Catalog item URLs look like /activities/ActivityTitle so I'm not able to add a second CSWP on an individual activity page and have it query the person, since their name isn't exposed in the URL, and I don't want to add a column to a person which contains the titles of all activities related to them (though I suppose that could work.)

Though the Credit column I created above is a Single Line of Text field, it is populated on the authoring site through an on-modify workflow that copies the value from a lookup field. (In other words, the content manager on the authoring site selects the value from a Lookup field, and a workflow populates the text field with the lookup value.) I did this since it's so much easier to work with text fields in CSWP than lookup fields, though I expect that as I become more capable this might not prove necessary.

If you want to know more about the solution described above, just let me know... happy to discuss. Relating information between lists continues to feel more an art than a science, especially on opposite sides of the search service, and I continue to learn better techniques everyday!

PS - I haven't played much with web API services, but rather than nesting a CSWP in the individual catalog item page, I'd assume if the DOM output produced is solid, you could use client-side JavaScript to read a field value from the rendered CSWP page (based on ID or name or something) and run a subsequent AJAX query against another list to retrieve related values.

Peace and Joy!

许可以下: CC-BY-SA归因
scroll top