Configure User segmentation in SharePoint 2013 Search Zero Code Solution

 Display content you tailor for user segments or context you define—for example, based on locale, interests, gender, Department, Skills etc.

The concept of "User Segmentation" is a new feature in SharePoint 2013 Search that allows you to view search results based on user attributes, called "User Segments".

When I speak of attributes, these are only attributes coming from the user's profile.

Scenario chosen for this article

"People Skills or Interests" which is "SPS-Skills" or “Department” Internal name in SharePoint user profile property.

  1. Need to filter the record against the People Skills or People Department in User Profile Property.
  2. User Profile property should have the value or terms in People Skills and People Department.


Step 1:- Define the People Skill in Managed Metadata services:-









Step 2:- Set above taxonomy terms in the User Profile property of the user i.e. SPS-Skills (Internal name of skill).



Step3:- Add Managed Metadata column in List or Library where we need to tag the content or Enable the Enterprise Keyword
Step4:- Add Skill Keyword i.e. Terms against the content in List or Library in Managed Metadata or Enterprise keyword column.

Step5:- Add Managed Metadata or Enterprise Keyword column as Managed Property in Search Schema and Perform the Full Crawl.

Step6:-Configure the OOTB Search Result Web Part in the search center with following steps:-

               




Note: - How Query variables with multiple values (Important)
Some query variables may return multiple values like Skills or Interest. For query variables that return multiple values, the following syntax must be used: {|ManagedProperty:{QueryVariable}}.
All the query variable values will be combined by using the bitwise OR operation. For example, say that you have a term set that is used to categorized interest of users. All users are configured to have one or more interests using the multi-value property SPS-Interests in the User Profile Service Application. To issue a query for any of the interests of the current user, the following syntax could be used: {|owstaxIdMetadataAllTagsInfo:{User.SPS-Skills}}.
 If the current user is configured to have two interests — .Net (#0f95d1fdf-781f-42f4-99f9-c656c1341b2e) and SharePoint (#0c2cff933-9377-4692-aa98-ce59768aa38b) — the query will be transformed to (owstaxIdMetadataAllTagsInfo: #0f95d1fdf-781f-42f4-99f9-c656c1341b2e) OR (owstaxIdMetadataAllTagsInfo: #0c2cff933-9377-4692-aa98-ce59768aa38b).

There are some restrictions with using multiple values. Only the OR operator ({|) is supported for multiple values. The AND operator is not supported. Also, only columns of type Managed Metadata work correctly for multiple value cases. Other types of columns that may use multiple values, such as columns of type Person or Group or Choice, the items will be expanded into a delimited string.

Ref:-


Migrate User from Moss 2007 to SharePoint 2013

After successfully migration of content Database from Moss 2007 to SharePoint 2013 via SharePoint 2010 as intermediate.

As part of this regular approach database detach –attach method and migrated the existing Moss 2007 site .Migration was successful and we were able to access the site  with the system account. Later we tried with couple of site admin accounts, to our surprise we were getting “ACCESS DENIED” with any other user id.

SharePoint assumes all users to be claim users and renders them so. Therefore, a normal windows user – “Domain\UserName” appears as “i:0#.w|Domain\UserName”.

To convert all window authentication user to claim based authentication:-

Open SharePoint 2013 Management Shell with Administrator account and run the below commands


$WebAppName = "http://"

$wa = get-SPWebApplication $WebAppName

$wa.UseClaimsAuthentication = $true

$wa.Update()

$wa.MigrateUsers($true)

$wa.ProvisionGlobally()

After successful provision, check the user - which will show claim based user and all user will be able to login the site also.

Happy Coding..

Google Vs Enterprise SharePoint 2013 Search

Why Enterprise Search Implementation is more sufficient at Enterprise level not google search

This article is more on thoughts.

As working on SharePoint 2013 Contextual search project. Meaning of Contextual is different in different prospective.
SharePoint Technology point of View, Contextual Meaning is Set Limit and Boundaries.
More Details: - If I search with in List, So List is my Context - system should search with in list only or if I am search with in Sub-Site, So Sub Site is my Context - system should search with in Sub site.
So this type of process is easy and where we can easily set limit and boundaries.
I have very informative article on that, which explained very nicely.

Now Story starts:-
Business says: - Contextual meaning User Context (Not User Segment): means: - What is user skill, Department, expertise, area of interest etc.
User Skill, Department, Expertise, area of Interest and lots more, these properties exists in use profile and we can access and use as input parameter for my search.

After Interval of the Story:-
We came to know, one more contextual meaning I.e. what are happening activity around the user i.e. what s (he) doing day-day basis.

Elaborate:-
What document, I am sharing with others and what people are sharing with me.
What type of conversation, I having with people and people having with me etc?


Then I thought, I should explore more on Exchange API, LYNC API, and OneDrive API etc. from where I will take the latest happening activity keyword and which will become the input for my search output.
It may consist confidential info also. I should carefully take care those also. Lots of other activity need to do for the same don’t know whether organization will allow me to take those information or not.

Now twist comes.
We are not “Google”. We are searching at Enterprise or Organizationa level.  Google is not having profile page and not having relevant keyword related user, so It take the relevancy key words from other social media and shows the result but at enterprise level we have enough data related to user. We should utilize those only.

Conclusion:-
Now the Use case exists:-
We have enough user data at the organization level which is exists in our system itself and which is exposed also in authorized environment. We should do the Proper ranking as per the weightage of the keyword and business requirement.

Please share your thought for the same.


Call Back Error in SharePoint People Picker Control.

Most of the blog says its permission issue: - at least for us it was not.


As per above article – I check all the permission and User Policy – Everything was properly set, UPSA was also working fine

Issue: - When I was checking for user in address book or people picker



When I was adding the user in SharePoint group – It was throwing the Unexpected error:-



Architecture Structure of Server:-
Why I am explaining the architecture server – It’s very important  because most of people doesn’t know how to check the logs in all server.If we have proper farm setup with multiple server – We should check the Logs in all server.




Here is Power shell command which give  consolidated result from all sharepoint server.
Merge-SPLogFile –Path “E:\SPLogs\MergedLogs.log” –Correlation 3ae2a6c0-da14-43a1-afda-5bb6bbff3d43




Resolution:-
Steps Followed:-

  • Restart SharePoint Timer Services
  • Remove the Attached DB from Web Application using Central Admin
  • Created DB with same Name.
  • After Configuring the DB – Unable to browse site. – It was showing “Page Not Found”.Scared what happen suddenly.
  • Finally - Clear the SharePoint Configuration Cache. Location “Drive:\ProgramData\Microsoft\SharePoint\Config\GUID”
  • Deleted all log files
  • Modify the Cache.ini with any numeric value put like 1 and save.

It seems like some services stuck in between or some configuration cache issue. After following the above steps.
SharePoint Site was browsing fine and people picker was also working fine without any fail.
Happy Coding.



Shrink the Content DB Log files

Don't know how many people faced these type of issue - Not able to proceed any thing in the share Point site - Reason "DB space is Full" - How to create the space. what we can compress or not  - so that at least work can continue unless until - administrator doesn't   add new disk or add more space to existing space.

Locate the database that has the log file and use either of the following sets of steps to shrink the transaction log file down to a reasonable size.

Option 1:- Manual Steps :-
Open the SQL Server Management Studio.
  1. Expand the Databases node and expand User Databases
  2. Right-click the database, and click Properties, which opens the Database Properties dialog box.
  3. In the Select a page pane, click Options.
  4. View the current recovery model in the Recovery model list box, which should be set to Full
  5. Click the dropdown arrow in the recovery model section and select the Simple recovery model
  6. Click OK.
  7. Right-click on the same database name and click Task-> Shrink-> Files 
  8. Use the File type drop-down menu and choose Log
  9. You can use the default setting of Release Unused Space or select Reorganize pages before releasing unused space, and you can specify the file size by supplying a value in the Shrink file to option.
           Note: the shrink may take some time depending on how large the file is and how much it has to shrink.
  1. After the shrink completes, change the recovery model back to Full by clicking the recovery model dropdown arrow and selecting the Full recovery model

Option 2:- Using SQL Command:-

use [databasename];
alter database [databasename] set recovery simple;
dbcc shrinkfile (2,0);
alter database [databasename] set recovery full;
for example:

use WSS_Content;
alter database WSS_Content set recovery simple;
dbcc shrinkfile (2,0);
alter database WSS_Content set recovery full;


Happy Coding !!

How to know Site Collection associated with which Content Database

Its like very simple and sweet post - How to know which site collection associated with which content database.

Power Shell Command:-

Get-SPContentDatabase | %{Write-Output "- $($_.Name)”; foreach($site in $_.sites){write-Output $site.url}}

Result look like this:-


We can easily convert the result into Text file using below command:-

Get-SPContentDatabase | %{Write-Output "- $($_.Name)”; foreach($site in $_.sites){write-Output $site.url}} > C:\sitecollections.txt


Result look like this:-


Happy Coding !!

SharePoint Farm Backup Size using Powershell

Farm Backup and restore activity - before performing any operation - Its very important to know the farm size 

To know the Farm size is very easy - Just use below power shell command:-

Power Shell Command

Get-SPDatabase | ForEach-Object {$db=0} {$db +=$_.disksizerequired; $_.name + ” – ” + $_.disksizerequired/1024/1024} {Write-Host “`nTotal Storage (in MB) =” (“{0:n0}” -f ($db/1024/1024))}

The above command gives the result like this:-

Happy Coding !!

SharePoint Get Content Database Size using Powersell

During Migration activity - it become very import to know the size of Content Database - which we are going to migrate.

To know the Content Database size is very easy - Just use below power shell command:-

Power Shell Command:-

Get-SPDatabase | ForEach-Object {$db=0} {$db +=$_.disksizerequired; $_.name + ” – ” + $_.disksizerequired/1024/1024} {Write-Host “`nTotal Storage (in MB) =” (“{0:n0}” -f ($db/1024/1024))}

The above command give the list of all database with size in MB.


Happy Coding !!

How to get Document Library Size SharePoint2013

Get to know the document library size is very easy - just few click away:-

Step 1:- Go to document library -> Library setting -> Modify the All Document View (Default one).


 Step 2:- Select the File Size Property from view

Step 3:- Go to little down in the same page expand the Total Section. Select File Size and Sum in the drop down as highlighted below and click ok.


Step 4:- Result will be available in KB (As I  have 4k+ document in Library)



Happy coding..

Enable MultiValue check box Refiner SharePoint2013 Search

Refiner is used to filtering the search results and limiting search as per filter criteria.

SharePoint 2013 search has OOTB Single Selection and Multi Selection template, by default single selection template is applied to refinement panel.

It pretty easy to enable count and multi selection check box.

Step 1:-
Go the Search Result Page or any search vertical (It should be in search center)

Step 2:-
Edit Page and then edit Right hand side zone with Refinement and click "Choose Refiner" button from refiner property box.


Step 3:-
Refinement Configuration Pop Up will be open. It will show all available managed property which user can used for filtering the records.
L.H.S shows all available  managed property and R.H.S shows all managed property will be available in search result pages for filtering the results.

User can select any property and apply OOTB display template as highlighted below i.e. Multivalue-Refinement Item. and click apply and check in the pages.





Step 4:-
Go to search result verticals and search any thing. Your changed refined will look like :-

Apply any filter with multiple check box and records start filtering accordingly.

Happy Coding..

Enable the Refiner Count in Share Point 2013


The refiner count show number of item exists in Search Result of that type. Its very easy to enable count number in refinement panel.

Its really enhance the search experience also. Don't why Microsoft has put as disable by default.

Enable Count for Refiner
The easiest configuration is to simply turn counts on for all refinements. This is achieved by modifing the Filter_Default.html and Filter_MultiValue.html display templates.

Step 1:-

Basically you need to change the Display Template for the Refinement Filter which is HTML file.
The File is located in the site collections MasterPage gallery folder, /_catalogs/masterpage/Display Templates/Filters


Step 2:-
Filter_Default.html and contains the definition for the refinement item.


Step 3:-
After Download the file Replace the below section:-

From -
To

Step 4:- 
Change the name of the Display Template
 Upload and Save the file at same location with Publish Version.

Step 5:-
Now Configure the Refinement Panel Web part with new defined template



Step 6:- Now Result should show the count in Refinement panel

Happy Coding and Simple Coding !!

Configure Contexual Search

Configure CONTEXTUAL  Search
Before configuring it we need to understand the search basics about Result sources and Query Rules. There are some nice articles available on tech-net which explain these in detail:
Understanding result sources for search in SharePoint Server 2013

https://technet.microsoft.com/en-us/library/dn186229.aspx


Configure result sources for search in SharePoint Server 2013

https://technet.microsoft.com/en-us/library/jj683115.aspx


Once you go through above articles next requirement is to customize your overall search experience and setting up contextual search. I came across a nice thread which explain this in detail



SharePoint 2013 Search Spelling Suggestion

Search Query Suggestions and Search Spelling Suggestions. They are not the same!
Query Suggestions are offered while the user types in the search box. 
Spelling Suggestions are offered only in the search results pages, after the user executes the search. 


Search Suggestion:-



There are four sources for spelling suggestions:

1. The default static spelling dictionaries (static out of the box dictionaries).

2. The default dynamic spelling dictionary (dynamically generated from your content). This     is also called a "content-aligned spelling dictionary".

3. The Query Spelling Inclusions term set (manually entered).
4. The Query Spelling Exclusions term set (manually entered).




Spelling suggestions are based on the closest matches in the default spelling dictionaries and the Query Spelling Inclusions list. 
Only one suggestion will be displayed. It appears that a phonic / sound alike match is being used, so the properly spelled and misspelled words must be similar in length and pattern.
You can’t edit the default static or dynamic spelling dictionaries.

Static dictionaries

The static dictionary is a canned list of words. (Something like the Word dictionaries.)

Dynamically created dictionaries

The dynamic dictionary is created by search as content is indexed. I.e. it's based on words commonly found in your content.

For dynamic spelling correction to work, you should have at least several thousand medium-sized documents. The default settings require that a word occur in at least 1000 documents to be included in the dictionary.

The dynamic dictionary is updated once a night and can be a long running process. (The default timeout is 6 hours!)

Query Spelling Inclusions / Exclusions

1. You must have a configured Managed Metadata Service.
2. The terms must be added to the auto-created Query Spelling Inclusions term set.
3. You manually enter a list of words into an include or exclude list of terms.
4. You can only include single words, not phrases in the term sets.


It may take ten minutes or more for updates to the term sets to show up in search results. (Search Custom Dictionaries Update timer job)

Using Power shell - Change the threshold limit for spelling suggestion (default is 1000 as stated above)


There are two PowerShell cmdlets that can be used to manage the on premises.

    Get-SPEnterpriseSearchQuerySpellingCorrection
    Set-SPEnterpriseSearchQuerySpellingCorrection

Note: These cmdlets are currently only for on premises SharePoint. It looks like Office 365 is set to use the Dynamic dictionary.
You can see the spelling suggestion options using:

    $ssa = Get-SPEnterpriseSearchServiceApplication
    Get-SPEnterpriseSearchQuerySpellingCorrection -SearchApplication $ssa
    


SpellingDictionary = Static / Dynamic

Many of the blogs state that you can choose either Static or Dynamic as the SpellingDictionary value, and that by selecting one of these you would exclude your manually entered Query Spelling Inclusions .

The confusion seems to be around the definitions of the words Static and Dynamic. 
My testing shows that:
  
Dynamic = use the list of words found in your content, plus the Query Spelling Inclusions term set

Static = use the static built-in / out of the box dictionary, plus the Query Spelling Inclusions term set

As an example, I do not have "SharePoint" or "SharePint" in my Query Spelling Inclusions term set, but I do have "corydoras". When I do a search for "SharePint" I get the following only when SpellingDictionary is set to Static: (this word is in the canned dictionary)
    
image

When searching for a term in the Query Spelling Inclusions term set like "corydoras"
 I get results regardless of if SpellingDictionary is set to Static or Dynamic.
    
image

Why don't I get any help when SpellingDictionary is set to Dynamic and I search for "SharePint"?
    
image

Take a look at the TermFrequencyThreshold property. Using the defaults SharePoint would need to find at least 1000 documents that contain the word "SharePoint". 

My testing sample set of documents is not quite that big. If I change it from 1000 to 20 and run the "Spelling dictionary update" timer job then I can start to get useful results from "Did you mean?" for "SharePint". (i.e. "SharePoint" was in at least 20 of my sample documents.)
    
image


Ref:  
https://technet.microsoft.com/en-in/library/jj219497.aspx
https://technet.microsoft.com/en-in/library/jj591607.aspx