Tag Archive: SharePoint full text search

When you search for pdf file, as default, SharePoint just looks for metadata and return search result with your expected. But the icon of pdf files display as unknow document type and important is SharePoint can not search within pdf content.

In this post, I will show you how to configure pdf icon in search result or document library and enable full text search for pdf content file.

1. Configure PDF Icon

– Download PDF Icon from  Adobe website: http://www.adobe.com/images/pdficon_small.gif and save it to Images folder under 14 hive folder (In my case C:\Program Files\Common Files\Microsoft Shared\Web server extensions\14\Template\Images)

– Open Command Prompt and type IISRESET -Stop to stop IIS and edit Docicon.xml

– Navigate XML folder  from C:\Program Files\Common Files\Microsoft Shared\Web Server extensions\14\Template\Xml  and open Docicon.xml by NotePad

– Insert <mapping key=”pdf” value=”pdficon_small.gif ” /> within the <ByExtension> section

– Save and Run command IISRESET -Start

– Add PDF file to the supported file types list

  • Open SharePoint Central Administration and login with Administrator permission
  • Click on Manage service applications link under Application Management section
  • Click on Search Service Application
  • In the Search Administration configuration page, click on File Types link from left sidebar
  • Select “New File Type”
  • In File extension textbox, type PDF and then click OK
  • Come back to file types list, confirm that PDF file in the list and show with pdf icon.

– Reload to see result in search page or document library

2. Install Adobe PDF iFilter

– As you know, PDF file is the standard and published by Adobe, that is the reason why SharePoint is not include as default of search. Adobe released Adobe PDF iFilter 9 for 64-bit platforms, which will allow searching PDF files on Microsoft Windows 64-bit platforms for desktop search,  Microsoft Office SharePoint Server, Microsoft Exchange Server, and Microsoft SQL Server… More information and download you can visit http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025 for iFilter verson 9

– Download and install PDFiFilter64installer.exe

– Follow installation instructions to complete install and configure SharePoint server to enable PDF indexing. This instructions is used for SharePoint 2007 but it nearly same on SharePoint 2010.

– Finally, Login Central Admin, Navigate Manage Service Application -> Search Service Application -> Select Content Source and Start Full Crawl. You have to run full crawl because SharePoint indexes file name in old file type extension list if you run Incremental  Crawl, so that when a new file type is added, it’s required to perform a full crawl to identify all file type in new list.

– Try to make a search within PDF content to test and the result should be like this

If you are not sure and confident with manually configuration as above. You can use the power shell script for out of box automatically configuration from configure PDF Icon to complete PDF iFilter installation. Download the script here. Thanks Josko for useful script.


Hoang Nhut Nguyen

Email: nhutcmos@gmail.com

Skype: hoangnhut.nguyen


As you know, SharePoint allow to define Search scope and condition to create full text search indexes. This is really one of greatest features SharePoint bring to you.

All search scopes will be managed by Share Services Provider (SSP). It’s easy to create a custom search scopes with friendly user interface.

You can see more details here:

For SharePoint 2007: http://dattard.blogspot.com/2007/04/sharepoint-2007-creating-custom-search.html

For SharePoint 2010: http://technet.microsoft.com/en-us/library/ff453895.aspx

In this post, I would like to focus in Developer side, SharePoint not only provide a powerful feature with ability to index many content, break down the content into different scopes, dynamic and friendly search for end user, but also Developer can query in each existed scopes like a Table  from SQL. It’s awesome!!!

See image below, I created some search scope: All Sites, Poeple, Document Libraries

From now, we can query on each scope as well as example code below

– Query to People Search Scope

DataTable resultDataTable = new DataTable();string SQLQueryString = “SELECT PersonalTitle, Firstname, Lastname, AccountName, Department, workemail”+
“WHERE \”scope\”=’People’ ORDER BY Write DESC”;using (FullTextSqlQuery searchQuery = new FullTextSqlQuery(ServerContext.Current))
SPSite contextSite = SPControl.GetContextSite(HttpContext.Current);

searchQuery.SiteContext = new Uri(contextSite.Url);
searchQuery.StartRow = 1;

if (rowLimit > 0)
searchQuery.RowLimit = 500;

searchQuery.EnableStemming = true;
searchQuery.KeywordInclusion = KeywordInclusion.AllKeywords;
searchQuery.ResultTypes = ResultType.RelevantResults;
searchQuery.TrimDuplicates = true;
searchQuery.QueryText = SQLQueryString;

ResultTableCollection searchResultTableCollection = searchQuery.Execute();
if ((int)ResultType.RelevantResults != 0)
searchResultTable = searchResultTableCollection[ResultType.RelevantResults];

– Or more simple to query to All Sites Search Scope

var query = new FullTextSqlQuery(SPContext.Current.Site)
QueryText = “SELECT Title FROM SCOPE() WHERE \”scope\” = ‘All Sites’ AND  CONTAINS(Title, ‘Example’)”,
ResultTypes = ResultType.RelevantResults
var queryResults = query.Execute();
var queryResultsTable = queryResults[ResultType.RelevantResults];
var results = new DataTable();
results.Load(queryResultsTable, LoadOption.OverwriteChanges);

That’s all, You can manually control search result and freely customize SharePoint search with available powerful full text search. So cool!

Related article:

Hoang Nhut Nguyen
Email: nhutcmos@gmail.com
Skype: hoangnhut.nguyen
%d bloggers like this: