How to Add Indexed Property to a Site So I can build a result source to search all sites for content with this property - sharepoint-online

I want to build a sharepoint online search result source that includes only some site collections and subsites. I have over 5000 Site collections, so I can't use named URLs/site ids in the result source - not maintainable. Instead I hope to add an indexed property to a site's property bag after site is provisioned then map a managed property to it, and use it in a resultsource to filter search results to match only content found in sites that have that property value. The Phil Harding's article describes the approach: https://platinumdogs.me/2015/02/06/set-a-propertybag-property-as-indexed-queryable-via-search-using-csom-powershell/ and Mike Morawski adds some code for the indexed property encoding - http://www.migee.com/2015/09/14/allowing-property-bag-values-to-be-searched-via-sharepoint-search/ I used bits of both to implement this approach.
Approach:
Add Key = 'SiteType', Value = 'MySiteType' to Web All Properties
Add Indexed Property 'SiteType' with 'MySiteType' Value to web IndexedProperties (vti_indexedpropertykeys). Key encoded to base64
Add Managed Property 'propSiteType' mapped to 'SiteType' Crawled property in Search Schema manually.
I've done 1 and 2 via Powershell+CSOM, and verify site property added and is crawled. Managed Property is there, but It is not available in ResultSource builder dialog, and any searches such as {searchterms} propSiteType:MySiteType or (contentclass:STS_Web OR contentclass:STS_Site) propSiteType:MySiteType do not return results.
Ideas or alternative approaches? Thanks in advance

My only thought is an indexing delay. I have seen O365 take days to index new content, and that's even when manually requesting a crawl. If that was the issue, it's probably resolved by now. Are you seeing relevant search results?
https://www.sharepointnutsandbolts.com/2013/10/waiting-for-search-crawl-in-office-365.html

Related

ListItem. Create managed property to sort result source

I have a custom contentType "Project Info" and 'Title' property is derrived from "Item".
I want to sort via Title (I'm using rest).
I have created a result source and while using the content type the I get the desired "project-items":
ContentTypeId:0x0100A5C45A8A8F7F904EA9BDB82895CC00C6*
So far so good...
I've tried to use "Refinablestring00" and map properties similar to 'Title' managed property.
Then I try to sort the result source via "refinablestring00" and it doesnt work.
Am I missing a mapped property, or what am I doing wrong?
I think the issue is the Mappings to Crawled Properties setting that is forced on the OOTB RefineableStrings. The Title Managed Property is set Include content from the first crawled property that contains information, but the RefinableStrings all have the forced setting in SharePoint Online of Include Content From All Crawled Properties. Because of this, if a search result has data for more than one of the mapped crawled properties, this could affect your sort order.
Unfortunately I think this is a big short coming to SPO when it comes to Search customization that hopefully will be addressed in the future as they learn better ways to manage Search across multiple tenancies.
What I would suggest is altering the mappings to only include one crawled property (the one that corresponds with the SharePoint list item Title field) and this should give you a result that's closer to what you're looking for.

Sitecore 7, Content Search, "Content" property of the document is not showing actual content

I have managed to get search results using LINQ way, I can access different fields of the searched document, including Title, Url, Path, etc.
I can also access Content property of the document but that is not showing actual content of the document. It is showing Title of the document separated by -, for example if the searched document Title is Video news items, Content property contains Video-news-items|Video news items.
How can I get actual content of the searched document?
Code I am using to search document is explained in another post.
Based on your other question, I assume you are using the base SearchResultItem class. You can inherit from this class and add Properties that map to specific fields in your items. you can then just use the properties as normal. This article explains the process:
Sitecore 7 POCO's explained
If you haven't yet done any research into Sitecore 7 search yet, I would suggest that you do some. The concepts may not be familiar.
I think this is showing meta title for this page

URL for Key Filter on document list view in SharePoint 2010

I'm trying to dynamically construct URLs in an ASP.NET MVC website that point back to a SharePoint list view with a Key Filter enabled for a managed metadata field (which uses a TermSet).
If I configure a navigation hierarchy for the managed metadata field, I see the following in the URL:
TreeField=MyCategory&TreeValue=0C37852B-34D0-418E-91C6-2AC25AF4BE5B
However, if configure the managed metdata field as a KeyFilter, I see the following in the URL:
#ServerFilter=FilterField1=MyCategory-FilterValue1=247-FilterLookupId1=1-FilterOp1=In
Where does the FilterValue1 value of 247 come from? It is not the database id of the MyCategory term. It is also not present anywhere on the Term object when loading the taxonomy through the SharePoint API. Is there a way to construct the query string to use the guid for the term (or better yet, the label, which I know will be unique).
The value comes from the taxonomy hidden list. Use the following method GetWssIdSoftTerm to get the int value the above urls are using to filter the data.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.taxonomyfield.getwssidsofterm.aspx

SharePoint Managed Properties (Mappings) - Multiple Site Collections

Have mapped properties for custom fields used in multiple site collections.
The property is also used to display additional information on the search results page if it contains information.
The search results work fine as content from each site collection is returned, but the managed property only contains data for content found on one particular site collection.
When configuring the managed property, there is only one option available to select the custom field I wish to map.
A full crawl has completed since configuring the managed property. The content from each site collection is being indexed, but the managed properties are only populated with data for content on one site collection.
Are the fields available to select when configuring a managed property from all site collections, or do I need to change a setting somewhere to tell it to look for custom fields in an alternate site collection?
Thanks in advance.
I've done this before and it is possible and indeed straightforward, you do not need to set any special settings. Just make sure that the internal names of the fields are the same (or all names are mapped to the managed property) and all lists/sites are set to be included in search results

Not sure how to programmatically filter by taxonomy metadata in my custom search webpart

I have pages in a pages library on a publishing site which have a managed metadata (taxonomy) field in their content type. I want my custom search webpart to read the taxonomy set on its parent page (I can do this fine) and then query against a specific scope using only the selected tags of the parent page as the filter (no keyword necessary).
I have tried to set FixedQuery = “owstaxIdMetadataAllTagsInfo=#0[TERM GUID]” of my CoreResultWebPart with no success... I actually gave up after I was getting 0 results and am now trying to just perform a FullTextSqlQuery.
Unfortunately it seems that even though pages with the managed metadata field are successfully being indexed, the managed property owstaxIdMetadataAllTagsInfo has no data in the results! I went ahead and made the property searchable/queryable and the property value is null.
Can you anyone confirm that I should be getting values from that managed property when there is indeed a managed metadata field on the page that is populated with data?
Note: I have tried to make my own managed property based on the managed metadata field in my site's content type -- same results.
I don't think - owstaxIdMetadataAllTagsInfo returns anything. I tried adding it to my result web part's Diaplay properties > fetched properties and got a property not recognized...related error.
So I created a separate metadata property for 'enterprise keywords' i.e. 'TaxKeyword. You need to ensure that you check the checkbox - 'Reduce storage requirements for text properties by using a hash for comparison' otherwise no results will be returned for that peroperty is you use LIKE predicate with fulltextsql.

Resources