Demos & POCs

Juan Carlos

How To Import Search Query Suggestions using PowerShell!

July 6th, 2014 | Author: | Filed under: CloudShare, Demos & POCs, Dev / Test, SharePoint, Training | Tags: , ,


Undoubtedly, SharePoint search is one of the most powerful features available in the platform not only for the out of the box features but also for the multiple extensibility points provided. In this post we will see how we can improve the search user experience through search query suggestions imported in SharePoint using the power provided by PowerShell.

  • Before going ahead with all the PowerShell staff, we need to define a file with all the query suggestions we want to add to the SharePoint Search. In my case, I have created a simple text file with all these suggestions. As you can see in the file structure, I’m using the QuerySuggestion term as a header in order to simplify the data processing required to extract each suggestion from the file.

image

  • Once we have ready the query suggestions, we need to define the PowerShell code that will import them in the SharePoint Search. This script, which is ready from download in How to import search query suggestions to the SharePoint Search, uses the cmdlet New-SPEnterpriseSearchLanguageResourcePhrase to add each Query Suggestion in a specific Scope (Search Service Application, Site Collection or Site). Finally, in order to provide the query suggestions to final users it’s required to execute the “Prepare query suggestions” Timer Job.

####################################################

# Script that allows to import query suggestions to the SharePoint Search.
# Required Parameters:
#    ->$sInputfile: Query suggestions file.
#    ->$sLanguage: Language for the Query Suggestions.
####################################################

If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell }

$host.Runspace.ThreadOptions = “ReuseThread”

#Definition of the function that imports new query suggestions to SharePoint
function Import-QuerySuggestions
{
param ($sInpuntFile,$sLanguage)
try
{
Write-Host “Importing Query Suggestions..” -ForegroundColor Green
#Checking if the query suggestions file exists
$bFileExists = (Test-Path $sInputFile -PathType Leaf)
if ($bFileExists) {
“Loading $sInputFile for processing…”
$tblData = Import-CSV $sInputFile
} else {
Write-Host “File $sInputFile not found. Stopping the Import Process!” -foregroundcolor Red
exit
}

$ssaSearchApp = Get-SPEnterpriseSearchServiceApplication -Identity “Search Service App”
$spSearchOwner = Get-SPEnterpriseSearchOwner -Level SSA

#Processing the file data
foreach ($row in $tblData){
$sQuerySuggestion=$row.QuerySuggestion.ToString()
Write-Host “Adding $sQuerySuggestion as a Query Suggestion”
New-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication  $ssaSearchApp -Language $sLanguage -Type QuerySuggestionAlwaysSuggest -Name $sQuerySuggestion -Owner $spSearchOwner
}

#Starting the Timer Job that makes available new query suggestions
$qsTimerJob = Get-SPTimerJob -type “Microsoft.Office.Server.Search.Administration.PrepareQuerySuggestionsJobDefinition”
Write-Host “Starting ” $qsTimerJob.Name ” Timber Job” -ForegroundColor Green
$qsTimerJob.RunNow()
Write-Host “Query Suggestions successfully imported!!” -ForegroundColor Green

}
catch [System.Exception]
{
write-host -f red $_.Exception.ToString()
}
}

Start-SPAssignment –Global
#Archivo con los Usuarios
$ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path
$sInputFile=$ScriptDir+ “\QuerySuggestions_Madrid.txt”
$sLanguage=”ES-es”
Import-QuerySuggestions -sInpuntFile $sInputFile -sLanguage $sLanguage
Stop-SPAssignment –Global

Remove-PSSnapin Microsoft.SharePoint.PowerShell

image

  • Of course, you can verify that all the query suggestions has been imported using again the magic and power of Windows PowerShell. In this case, I have prepared a small script that you can get again in the TechNet Script Gallery (How to get all query suggestions defined in a SharePoint Farm!. As you can see in the script, you only need to properly call the Get-SPEnterpriseSearchQueryCantidates in order to get all query suggestions available in the SharePoint farm.

###################################################

# Script that allows to get all the query suggestions already defined in a SharePoint farm.
####################################################

If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell }

$host.Runspace.ThreadOptions = “ReuseThread”

#Definition of the function that gets current query suggestions in the SharePoint farm
function Get-QuerySuggestions
{
try
{
Write-Host “Getting all the query suggestions…” -ForegroundColor Green
$ssaSearchApp = Get-SPEnterpriseSearchServiceApplication -Identity “Search Service App”
$spSearchOwner = Get-SPEnterpriseSearchOwner -Level SSA
Get-SPEnterpriseSearchQuerySuggestionCandidates -SearchApplication $ssaSearchApp -Owner $spSearchOwner
}
catch [System.Exception]
{
write-host -f red $_.Exception.ToString()
}
}

Start-SPAssignment –Global
Get-QuerySuggestions
Stop-SPAssignment –Global

Remove-PSSnapin Microsoft.SharePoint.PowerShell

image

  • Finally, just verify your query suggestions are ready to use in a SharePoint Search Center.

image

And that’s all about how to import Search Query Suggestions to SharePoint using PowerShell. Happy CloudSharing!


Juan Carlos

How to determine the size of the SharePoint Content DBs in a SharePoint Farm!

June 20th, 2014 | Author: | Filed under: CloudShare, Demos & POCs, Dev / Test, SharePoint, Training | Tags: ,


One of the most common administration tasks when managing a SharePoint environment is to have under control the sizes of the SharePoint content databases available in a SharePoint farm. Although there are several possibilities to get this information, I recommend you to use Windows PowerShell so you can take advantage of the features and great capabilities it provides when doing SharePoint administration task. As you will learn in this article, you can easily get the size for your SharePoint Content Databases by means of a PowerShell Script.

Read the rest of this entry »


Chris Riley

We are developers too!

June 17th, 2014 | Author: | Filed under: CloudShare, Demos & POCs, Dev / Test | Tags: , , ,


CloudShare is a tool that many developers have made apart of their day-to-day work. And that platform has to be built just like any other application.  Our awesome team of developers faces the same processes and challenges that the entire development world does, and they want to share their story with you.

Read the rest of this entry »


Juan Carlos

SharePoint 2013 and Yammer Integration Features in the Service Pack 1

April 26th, 2014 | Author: | Filed under: CloudShare, Demos & POCs, Dev / Test, SharePoint | Tags: , ,


After some weeks where I guess SharePoint team has been very busy, we can finally say that the “real and definitive” service pack (SP) 1 for SharePoint 2013 has just arrived and it’s ready to download and install on your SharePoint deployments (Note: For your reference, I recommend you to read Stefan Goßner ’s blog post about the re-release of SharePoint 2013 SP 1. In this article I will show you one of the enhancements included as part of the SharePoint 2013 SP 1: a first integration approach between SharePoint 2013 and Yammer. Indeed, SharePoint 2013 included a first approach to real hybrid solutions where we will have out of the box the possibility of using on-premises and Office 365 features.

Read the rest of this entry »


Scott Petri

Controlling your Costs with Environment Policies

April 14th, 2014 | Author: | Filed under: CloudShare, Demos & POCs, Dev / Test | Tags: , , , , , ,


Managing policies …and your usage …and your costs …and how it all adds up sounds super dull, right? And it is.

That is, until it isn’t. Have you ever had to experienced the feeling of going to your boss or any other financial controller in your company with an unexpected bill? And that bill happened to be larger than you could have imagined? It’s a long walk to their office isn’t it? Well, we don’t want you to experience that, ever!

Read the rest of this entry »


Daniel Bakshi

Inception: The journey of nested virtualization

March 25th, 2014 | Author: | Filed under: CloudShare, Demos & POCs, Dev / Test, Training | Tags: , , , , , ,


If you’ve not been living on the moon, you’ve probably heard of the concept of “Nested Virtualization”.
This is a method of running a Virtual Machine inside a Virtual Machine.

Read the rest of this entry »


Juan Carlos

Installing SharePoint 2013 SP1 in a CloudShare environment and what’s new in the box!

March 1st, 2014 | Author: | Filed under: Demos & POCs, Dev / Test, SharePoint | Tags: , , , ,


Microsoft has recently released the Service Pack (SP) 1 for SharePoint 2013. In this article I will show you how easy is to install the first SP for SharePoint 2013 and also some of the new goodies coming with the platform. Let’s start.

Read the rest of this entry »


Juan Carlos

How to create a Web Performance Test for SharePoint 2013 using VS 2013 Update 1 – Part II!

February 14th, 2014 | Author: | Filed under: Demos & POCs, Dev / Test, SharePoint | Tags: , , , , ,


In this article I will continue talking about how to create a Web Performance Test for SharePoint 2013 using Visual Studio 2013 (VS 2013) Update 1 in a SharePoint 2013 CloudShare environment. If you remember, in my last post about this topic I explained how easy is to define and create a Web Performance Test in VS 2013 Update 1. In this blog post, we will see how to execute an existing Web Test and also the performance information provided by the IDE.

Read the rest of this entry »


Juan Carlos

How to create a Web Performance Test for SharePoint 2013 using VS 2013 Update 1 – Part I!

February 3rd, 2014 | Author: | Filed under: CloudShare, Demos & POCs, Dev / Test, SharePoint, Training | Tags: , , , ,


In this post I will explain how you can do web performance tests in SharePoint 2013. In the same way you can detect/prevent any issue or problem on your SharePoint Solutions doing an exhaustive analysis using tools like MSOCAF (Microsoft SharePoint Online Code Analysis Framework), you can verify performance and stress abilities on your SharePoint applications by creating web performance and load tests. In this first post I will show you how to create a Web Performance Test for SharePoint 2013 using Visual Studio 2013 (VS 2013) Update 1 in a SharePoint 2013 CloudShare environment.

Read the rest of this entry »


Robby Valentine Robby Valentine

How-to: QlikView in the Cloud!

January 31st, 2014 | Author: | Filed under: Demos & POCs, Dev / Test | Tags: , , , , , , , ,


CloudShare’s virtualization platform makes it easy to quickly and cost effectively stand up key resources for any size QlikView deployment whether it be a single server for quick dev/test initiatives or multiple servers to explore an end-to-end enterprise topology.  In this post we’re going to look at creating a development environment on the CloudShare virtualization platform in order to jump start a QlikView project.

Read the rest of this entry »