Monday 15 June 2015

Content Search Query rules to find all Sub Sites within the Current Site

Query:

contentclass:STS_Web 
Path:{Site.URL} 
Site<>{Site.URL}

How-to:

  1. This rule will only show sites. At this stage it shows all the sites across the whole environment.
  2. This rule will limit the results to sites with the current site. This also include the top level site.
  3. This rule removed the top level site, thus only showing the sub sites. 
  4. This rule removed the top level site, thus only showing the sub sites. 

How to Map the "Expires" date column in the Search Schema for SharePoint Online (Office 365)

With SharePoint Online you can’t create a New mapped search column as simply as SharePoint On-Prem. With SharePoint Online it is best to use one of the pre-created mapped search columns, created for you, by SharePoint to use. I.e. RefinableString, RefinableDate, RefinableInt and RefinableDecimal.

For this example I will be Mapping this column, for my whole SharePoint Online environment, so all my Site Collection can access this Search Mapped Column.

  1. Goto your SharePoint Online Admin Center
  2. Click "search" on the quick links menu (on the left)
  3. Filter by "refinabledate"
  4. Click "RefinableDate00"
  5. You can see that this column is already for searching, and has been configured to be a "Date and Time" column type
  6. Add an Alias to this column. This will inform other and "future you", what this column is for. 
    Alias: AnnouncementExpiryDate
  7. Scroll down to "Mapping to crawl properties", and click "Add a Mapping"
  8. Find "Search for crawled property name": Expires
  9. Select "ows_Expires"
  10. Click "OK"
  11. Click "OK"
  12. To see the column mapped, filter again by "refinabledate"
Now you just have to wait for the SharePoint Online Crawl to run :)

Content Search Query Rule for showing item with a future Expiry Date, or have Blank Dates.

There are so many cool ways you can use the Content Search Query rule, I blog about last (Content Search Query Rule for showing Items Modified Today).

So in this example, I have a list of Announcements. These Announcements have an Expiry Date. This Expiry Date column can be blank or have a date.

The Content Search Rollup must show all item which has a future Expiry Date, or are blank.

Note: The column which is being used to compare the date, must be a mapped in the Search Schema as a DATE (Date and Time) column. 

Note: The default “Expires” column is not automatically mapped, by the Search Schema. There is a mapped column called “ExpiresOWSDATE”, but this column is mapped as text. 

Query Rule:
-RefinableDate00:1900-01-01..{Today}




The reason this is such a cool rule, is because it show items with Blank Dates.

Please see next blog on: How to Map the "Expires" date column in the Search Schema for SharePoint Online (Office 365)

Tuesday 9 June 2015

Content Search Query Rule for showing Items Modified Today

I just learnt a really cool Content Search Query Rule which I just have to share.

So in the Content Search Web Part Query, you add:
-LastModifiedTime:1900-01-01..{Today-1}


The Search result will then only show you item which where modified today. Thus is removing anything from 1900-01-01 to anything created Yesterday (Today-1).