Content Source – Enterprise Search Service

Plan content sources

content source is a set of options that you can use to specify what type of content is crawled, what URLs to crawl, and how deep and when to crawl. The default content source is Local SharePoint sites. You can use this content source to specify how to crawl all content in all Web applications that are associated with a particular Search service application. By default, for each Web application that uses a particular Search service application, SharePoint Server 2010 adds the start address of the top-level site of each site collection to the default content source.

Some organizations can use the default content source to satisfy their search requirements. However, many organizations have to have additional content sources. Plan additional content sources when you have to do the following:

  • Crawl different types of content — for example, SharePoint sites, file shares, and business data.
  • Crawl some content on different schedules than other content.
  • Limit or increase the quantity of content that is crawled.
  • Set different priorities for crawling different sites.

Plan to crawl different kinds of content

You can only crawl one kind of content per content source.

  1. SharePoint Sites: SharePoint sites from the same farm or different Microsoft SharePoint Server 2010, Microsoft SharePoint Foundation 2010, or Microsoft Search Server 2010 farms
  2. Web Sites: Other Web content in your organization that is not located in SharePoint sites, Content on Web sites on the Internet
  3. File Shares: Content on file shares in your organization
  4. Exchange Public Folders: Microsoft Exchange Server content
  5. Line of Business Data: Business data that is stored in line-of-business applications

Note : You cannot crawl the same start addresses by using multiple content sources in the same Search service application. For example, if you use a particular content source to crawl a site collection and all its subsites, you cannot use a different content source to crawl one of those subsites separately on a different schedule.

Plan file-type inclusions and IFilters

Content is only crawled if the relevant file name extension is included in the file-type inclusions list and an IFilter is installed on the crawl server that supports those file types. Several file types and IFilters are included automatically during initial installation. When you plan for content sources in your initial deployment, determine whether content that you want to crawl uses file types that are not included. If file types are not included, you must add those file types on the Manage File Types page during deployment and ensure that an IFilter is installed and registered to support that file type.

If you want to exclude certain file types from being crawled, you can delete the file name extension for that file type from the file type inclusions list.

Content Source Scope Rule creation in SharePoint 2010

We can create Content Source Scope Rule in SharePoint 2010 Enterprise Search Service Application from Central Administration.

Go to Central Administration => Application Management => Manage Service Applications => Enterprise Search Service Application.

On the Quick Launch Menu, go to Queries and Results then click on Scopes.

You could be able to see the Scopes.

In the Scope Rule Type section, select Content Source.

In the Content Sources section, select the Content Source that has to be added to the scope rule.

Click on Ok.

Click on the Scope to which Scope Rule has to be added.

Click on Add New Rule link to add the new scope rule.

Create Content Source using PowerShell 

CreateContentSources.xml

<?xmlversion=1.0encoding=utf-8 ?>

<ContentSources>

<SSAName>EnterPrise Search Service Application</SSAName>

<ContentSourceName=Sample1 SharePoint Sites />

<ContentSourceName=Sample2 SharePoint Sites />

<ContentSourceName=Sample3 SharePoint Sites />

</ContentSources>

CreateContentSources.ps1

#—————-Get the xml file—————————————————————

[xml]$xmlData=Get-Content “C:\Users\Desktop\ContentSources\CreateContentSources.xml

 #—————-Create New Content Source function———————————————

function CreateNewContentSource

{

$flag=0

$ssa=Get-SPEnterPriseSearchServiceApplication -Identity $xmlData.SSAName

$ssaContent = newobject Microsoft.Office.Server.Search.Administration.Content($ssa)

$xmlData.ContentSources.ContentSource | ForEach-Object {

$contentSourceName=$_.Name

foreach ($availableContentSource in $ssaContent.ContentSources)

{

if ($availablecontentSource.Name.ToString() -eq $contentSourceName)

{

write-host -f Yellow $contentSourceName “content source already exists”

write-host -f Yellow Deleting $contentSourceName content source

$availablecontentSource.Delete()

write-host -f Green $contentSourceName content source is deleted successfully

write-host -f yellow Creating $contentSourceName

$ssaContent.ContentSources.Create([Microsoft.Office.Server.Search.Administration.SharePointContentSource], $contentSourceName)

write-host -f green $contentSourceName “content source is added successfully”

$Flag=1

break

}

}

if($Flag -eq 0)

{

write-host -f yellow Creating $contentSourceName

$ssaContent.ContentSources.Create([Microsoft.Office.Server.Search.Administration.SharePointContentSource], $contentSourceName)

write-host -f green $contentSourceName “content source is added successfully”

}

}

}

#—————-Calling the function———————————————

CreateNewContentSource

Run the Script:

1. Go to Start.
2. Click on All Programs.
3. Click on Microsoft SharePoint 2010 Products and then click on SharePoint 2010 Management Shell.
4. Run the C:\Users\Desktop\ContentSources\CreateContentSources.ps1


Create Content Source Scope Rule using PowerShell 

CreateContentSourceScopeRules.xml

<?xmlversion=1.0encoding=utf-8 ?>

<ScopeRules>

<SSAName>AZ ESP EnterPrise Search Service Application</SSAName>

<ScopeURL>http://ukslazspddev06:8080/</ScopeURL>

<RuleScopeName=Sample1ContentSourceName=Sample1 SharePoint Sites />

<RuleScopeName=Sample2ContentSourceName=Sample2 SharePoint Sites />

<RuleScopeName=Sample3ContentSourceName=Sample3 SharePoint Sites />

</ScopeRules>

CreateContentSourceScopeRules.ps1

#—————-Get the xml file—————————————————————

[xml]$xmlData=Get-Content “C:\Users\Desktop\ContentSources\CreateContentSourceScopeRules.xml”

#—————-Create Content Source Scope Rule function——————————————

Function CreateContentSourceScopeRule()

{

$flag=0

$ssa=Get-SPEnterPriseSearchServiceApplication -Identity $xmlData.SSAName

$ssaContent = newobject Microsoft.Office.Server.Search.Administration.Content($ssa)

$scopeCollection=Get-SPEnterpriseSearchQueryScope -SearchApplication $ssa

$xmlData.ScopeRules.Rule | ForEach-Object {

$ScopeName=$_.ScopeName

$contentSourceName=$_.ContentSourceName

$scope=Get-SPEnterpriseSearchQueryScope -SearchApplication $ssa | Where-Object {$_.Name -eq $ScopeName}

if($scope -ne $null)

{

foreach ($availableContentSource in $ssaContent.ContentSources)

{

if ($availablecontentSource.Name.ToString() -eq $contentSourceName)

{

$flag=1

break

}

}

if($flag -eq 1)

{

$ScopeRules=Get-SPEnterpriseSearchQueryScopeRule -Scope $scope | Where-Object {$_.Value -eq $contentSourceName}

if($scopeRuleFlag -ne $null)

{

write-host -f Yellow “Can’t add or modify scope rule. A rule with the same parameters already exists in this scope”

}

else

{

write-host -f Magenta Creating Content Source Scope Rule

New-SPEnterpriseSearchQueryScopeRule -RuleType PropertyQuery -ManagedProperty ContentSource -PropertyValue $contentSourceName -FilterBehavior Include -URL $xmldata.ScopeRules.ScopeURL -scope $scope -SearchApplication $ssa

write-host -f Green Content Source Scope Rule is created successfully to $ScopeName scope

}

}

else

{

write-host -f Yellow $contentSourceName content source does not exists

}

}

else

{

write-host -f yellow $ScopeName scope does not exists

}

}

}

 #—————-Calling the function———————————————

CreateContentSourceScopeRule

Run the Script:

1. Go to Start.
2. Click on All Programs.
3. Click on Microsoft SharePoint 2010 Products and then click on SharePoint 2010 Management Shell.
4. Run the C:\Users\Desktop\ContentSources\CreateContentSourceScopeRules.ps1

Output:

Reference : http://technet.microsoft.com/en-us/library/cc262926.aspx

http://www.dotnetfunda.com/articles/article1624-create-a-content-source-scope-rule-in-sharepoint-2010-using-powershell.aspx

Advertisements

12 thoughts on “Content Source – Enterprise Search Service

  1. I’ve read several good stuff here. Definitely price
    bookmarking for revisiting. I surprise how a lot effort
    you place to create this kind of wonderful informative site.

  2. I do not know if it’s just me or if everybody else encountering problems with your site.

    It appears as if some of the written text on your content are running off the
    screen. Can somebody else please comment and let me know if this is
    happening to them as well? This may be a problem with my internet browser because I’ve had
    this happen previously. Many thanks

  3. Spot on with this write-up, I actually think this web site needs a lot more attention.
    I’ll probably be back again to read through more, thanks for the advice!

  4. Have you ever thought about adding a little bit
    more than just your articles? I mean, what you say is valuable and everything.
    But think of if you added some great pictures or video clips to give your
    posts more, “pop”! Your content is excellent but with images and videos,
    this website could definitely be one of the best in its niche.
    Superb blog!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s