Today, I’d like to show you how to deploy your custom advanced search page using module in Visual Studio 2012.Using a module is the way how SharePoint deploy all the publishing pages to the search centre. Browse to the template under 15 hive of SharePoint2013, then go to the SearchCenterFiles under Features(as shown below).Then open the Files.xml it shows how SharePoint using module to deploy advanced search.You can download the solution here.
Now I am going to show you how to deploy your custom advanced search page.The feature is located in the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\FEATURES\SearchCenterFiles .
To deploy SharePoint advanced Search pages, you need to do the following:
1. Create SharePoint2013 project and then create a module item.
2. Find how Out of box SharePoint deploy the Advanced Search Page from Files.xml and copy and paste it into the elements.xml
<File Url="advanced.aspx" Type="GhostableInLibrary">
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/AdvancedSearchLayout.aspx, $Resources:Microsoft.Office.Server.Search,SearchCenterAdvancedSearchTitle;" />
<Property Name="Title" Value="$Resources:Microsoft.Office.Server.Search,Search_Advanced_Page_Title;" />
<Property Name="ContentType" Value="$Resources:Microsoft.Office.Server.Search,contenttype_welcomepage_name;" />
<AllUsersWebPart WebPartZoneID="MainZone" WebPartOrder="1">
<![CDATA[
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
<Assembly>Microsoft.Office.Server.Search, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.Office.Server.Search.WebControls.AdvancedSearchBox</TypeName>
<Title>$Resources:Microsoft.Office.Server.Search,AdvancedSearch_Webpart_Title;</Title>
<Description>$Resources:Microsoft.Office.Server.Search,AdvancedSearch_Webpart_Description;</Description>
<FrameType>None</FrameType>
<AllowMinimize>true</AllowMinimize>
<AllowRemove>true</AllowRemove>
<IsVisible>true</IsVisible>
<SearchResultPageURL xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">results.aspx</SearchResultPageURL>
<TextQuerySectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">$Resources:Microsoft.Office.Server.Search,AdvancedSearch_FindDocsWith_Title;</TextQuerySectionLabelText>
<ShowAndQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowAndQueryTextBox>
<ShowPhraseQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowPhraseQueryTextBox>
<ShowOrQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowOrQueryTextBox>
<ShowNotQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowNotQueryTextBox>
<ScopeSectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">$Resources:Microsoft.Office.Server.Search,AdvancedSearch_NarrowSearch_Title;</ScopeSectionLabelText>
<ShowLanguageOptions xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowLanguageOptions>
<ShowResultTypePicker xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowResultTypePicker>
<ShowPropertiesSection xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowPropertiesSection>
<PropertiesSectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">$Resources:Microsoft.Office.Server.Search,AdvancedSearch_AddPropRestrictions_Title;</PropertiesSectionLabelText>
</WebPart>
]]>
</AllUsersWebPart>
</File>
3. Customize your SharePoint advanced Search Page by modifying the Advanced Search Box and Export the webpart and copy the webpart file to the elements under module.
4. Export the web part and copy the content of the web part file to the elements.xml in the module.
<File Path="AdvancedSearchPage\advanced.aspx" Url="employeeAdvanced.aspx" Type="GhostableInLibrary">
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/AdvancedSearchLayout.aspx, $Resources:Microsoft.Office.Server.Search,SearchCenterAdvancedSearchTitle;" />
<Property Name="Title" Value="$Resources:Microsoft.Office.Server.Search,Search_Advanced_Page_Title;" />
<Property Name="ContentType" Value="$Resources:Microsoft.Office.Server.Search,contenttype_welcomepage_name;" />
<AllUsersWebPart WebPartZoneID="MainZone" WebPartOrder="1">
<![CDATA[
<WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/WebPart/v2">
<Title>Advanced Search Box</Title>
<FrameType>None</FrameType>
<Description>Displays parameterized search options based on properties and combinations of words.</Description>
<IsIncluded>true</IsIncluded>
<ZoneID>MainZone</ZoneID>
<PartOrder>1</PartOrder>
<FrameState>Normal</FrameState>
<Height />
<Width />
<AllowRemove>true</AllowRemove>
<AllowZoneChange>true</AllowZoneChange>
<AllowMinimize>true</AllowMinimize>
<AllowConnect>true</AllowConnect>
<AllowEdit>true</AllowEdit>
<AllowHide>true</AllowHide>
<IsVisible>true</IsVisible>
<DetailLink />
<HelpLink />
<HelpMode>Modeless</HelpMode>
<Dir>Default</Dir>
<PartImageSmall />
<MissingAssembly>Cannot import this Web Part.</MissingAssembly>
<PartImageLarge />
<IsIncludedFilter />
<Assembly>Microsoft.Office.Server.Search, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.Office.Server.Search.WebControls.AdvancedSearchBox</TypeName>
<SearchResultPageURL xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">results.aspx</SearchResultPageURL>
<TextQuerySectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">Find documents that have...</TextQuerySectionLabelText>
<ShowAndQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowAndQueryTextBox>
<AndQueryTextBoxLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" />
<ShowPhraseQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowPhraseQueryTextBox>
<PhraseQueryTextBoxLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" />
<ShowOrQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowOrQueryTextBox>
<OrQueryTextBoxLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" />
<ShowNotQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowNotQueryTextBox>
<NotQueryTextBoxLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" />
<ScopeSectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">Narrow the search...</ScopeSectionLabelText>
<ShowScopes xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">false</ShowScopes>
<ScopeLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" />
<DisplayGroup xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">Advanced Search</DisplayGroup>
<ShowLanguageOptions xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">false</ShowLanguageOptions>
<LanguagesLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" />
<ShowResultTypePicker xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowResultTypePicker>
<ResultTypeLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" />
<ShowPropertiesSection xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowPropertiesSection>
<PropertiesSectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">Add property restrictions...</PropertiesSectionLabelText>
<Properties xmlns="urn:schemas-microsoft-com:AdvancedSearchBox"><root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <LangDefs> <LangDef DisplayName="Arabic" LangID="ar"/> <LangDef DisplayName="Bengali" LangID="bn"/> <LangDef DisplayName="Bulgarian" LangID="bg"/> <LangDef DisplayName="Catalan" LangID="ca"/> <LangDef DisplayName="Simplified Chinese" LangID="zh-cn"/> <LangDef DisplayName="Traditional Chinese" LangID="zh-tw"/> <LangDef DisplayName="Croatian" LangID="hr"/> <LangDef DisplayName="Czech" LangID="cs"/> <LangDef DisplayName="Danish" LangID="da"/> <LangDef DisplayName="Dutch" LangID="nl"/> <LangDef DisplayName="English" LangID="en"/> <LangDef DisplayName="Finnish" LangID="fi"/> <LangDef DisplayName="French" LangID="fr"/> <LangDef DisplayName="German" LangID="de"/> <LangDef DisplayName="Greek" LangID="el"/> <LangDef DisplayName="Gujarati" LangID="gu"/> <LangDef DisplayName="Hebrew" LangID="he"/> <LangDef DisplayName="Hindi" LangID="hi"/> <LangDef DisplayName="Hungarian" LangID="hu"/> <LangDef DisplayName="Icelandic" LangID="is"/> <LangDef DisplayName="Indonesian" LangID="id"/> <LangDef DisplayName="Italian" LangID="it"/> <LangDef DisplayName="Japanese" LangID="ja"/> <LangDef DisplayName="Kannada" LangID="kn"/> <LangDef DisplayName="Korean" LangID="ko"/> <LangDef DisplayName="Latvian" LangID="lv"/> <LangDef DisplayName="Lithuanian" LangID="lt"/> <LangDef DisplayName="Malay" LangID="ms"/> <LangDef DisplayName="Malayalam" LangID="ml"/> <LangDef DisplayName="Marathi" LangID="mr"/> <LangDef DisplayName="Norwegian" LangID="no"/> <LangDef DisplayName="Polish" LangID="pl"/> <LangDef DisplayName="Portuguese" LangID="pt"/> <LangDef DisplayName="Punjabi" LangID="pa"/> <LangDef DisplayName="Romanian" LangID="ro"/> <LangDef DisplayName="Russian" LangID="ru"/> <LangDef DisplayName="Slovak" LangID="sk"/> <LangDef DisplayName="Slovenian" LangID="sl"/> <LangDef DisplayName="Spanish" LangID="es"/> <LangDef DisplayName="Swedish" LangID="sv"/> <LangDef DisplayName="Tamil" LangID="ta"/> <LangDef DisplayName="Telugu" LangID="te"/> <LangDef DisplayName="Thai" LangID="th"/> <LangDef DisplayName="Turkish" LangID="tr"/> <LangDef DisplayName="Ukrainian" LangID="uk"/> <LangDef DisplayName="Urdu" LangID="ur"/> <LangDef DisplayName="Vietnamese" LangID="vi"/> </LangDefs> <Languages> <Language LangRef="en"/> <Language LangRef="fr"/> <Language LangRef="de"/> <Language LangRef="ja"/> <Language LangRef="zh-cn"/> <Language LangRef="es"/> <Language LangRef="zh-tw"/> </Languages> <PropertyDefs> <PropertyDef Name="Path" DataType="url" DisplayName="URL"/> <PropertyDef Name="Size" DataType="integer" DisplayName="Size (bytes)"/> <PropertyDef Name="Write" DataType="datetime" DisplayName="Last Modified Date"/> <PropertyDef Name="FileName" DataType="text" DisplayName="Name"/> <PropertyDef Name="Description" DataType="text" DisplayName="Description"/> <PropertyDef Name="Title" DataType="text" DisplayName="Title"/> <PropertyDef Name="Author" DataType="text" DisplayName="Author"/> <PropertyDef Name="DocSubject" DataType="text" DisplayName="Subject"/> <PropertyDef Name="DocKeywords" DataType="text" DisplayName="Keywords"/> <PropertyDef Name="DocComments" DataType="text" DisplayName="Comments"/> <PropertyDef Name="CreatedBy" DataType="text" DisplayName="Created By"/> <PropertyDef Name="ModifiedBy" DataType="text" DisplayName="Last Modified By"/> <PropertyDef Name="EmployeeNumber" DataType="text" DisplayName="EmployeeNumber"/> <PropertyDef Name="EmployeeId" DataType="text" DisplayName="EmployeeId"/> <PropertyDef Name="EmployeeFirstName" DataType="text" DisplayName="EmployeeFirstName"/> <PropertyDef Name="EmployeeLastName" DataType="text" DisplayName="EmployeeLastName"/> </PropertyDefs> <ResultTypes> <ResultType DisplayName="Employee Document" Name="default"> <KeywordQuery/> <PropertyRef Name="EmployeeNumber" /> <PropertyRef Name="EmployeeId" /> <PropertyRef Name="EmployeeFirstName" /> <PropertyRef Name="EmployeeLastName" /> </ResultType> <ResultType DisplayName="All Results"> <KeywordQuery/> <PropertyRef Name="Author" /> <PropertyRef Name="Description" /> <PropertyRef Name="FileName" /> <PropertyRef Name="Size" /> <PropertyRef Name="Path" /> <PropertyRef Name="Write" /> <PropertyRef Name="CreatedBy" /> <PropertyRef Name="ModifiedBy" /> </ResultType> <ResultType DisplayName="Documents" Name="documents"> <KeywordQuery>IsDocument="True"</KeywordQuery> <PropertyRef Name="Author" /> <PropertyRef Name="DocComments"/> <PropertyRef Name="Description" /> <PropertyRef Name="DocKeywords"/> <PropertyRef Name="FileName" /> <PropertyRef Name="Size" /> <PropertyRef Name="DocSubject"/> <PropertyRef Name="Path" /> <PropertyRef Name="Write" /> <PropertyRef Name="CreatedBy" /> <PropertyRef Name="ModifiedBy" /> <PropertyRef Name="Title"/> </ResultType> <ResultType DisplayName="Word Documents" Name="worddocuments"> <KeywordQuery>FileExtension="doc" OR FileExtension="docx" OR FileExtension="dot" OR FileExtension="docm" OR FileExtension="odt"</KeywordQuery> <PropertyRef Name="Author" /> <PropertyRef Name="DocComments"/> <PropertyRef Name="Description" /> <PropertyRef Name="DocKeywords"/> <PropertyRef Name="FileName" /> <PropertyRef Name="Size" /> <PropertyRef Name="DocSubject"/> <PropertyRef Name="Path" /> <PropertyRef Name="Write" /> <PropertyRef Name="CreatedBy" /> <PropertyRef Name="ModifiedBy" /> <PropertyRef Name="Title"/> </ResultType> <ResultType DisplayName="Excel Documents" Name="exceldocuments"> <KeywordQuery>FileExtension="xls" OR FileExtension="xlsx" OR FileExtension="xlsm" OR FileExtension="xlsb" OR FileExtension="ods"</KeywordQuery> <PropertyRef Name="Author" /> <PropertyRef Name="DocComments"/> <PropertyRef Name="Description" /> <PropertyRef Name="DocKeywords"/> <PropertyRef Name="FileName" /> <PropertyRef Name="Size" /> <PropertyRef Name="DocSubject"/> <PropertyRef Name="Path" /> <PropertyRef Name="Write" /> <PropertyRef Name="CreatedBy" /> <PropertyRef Name="ModifiedBy" /> <PropertyRef Name="Title"/> </ResultType> <ResultType DisplayName="PowerPoint Presentations" Name="presentations"> <KeywordQuery>FileExtension="ppt" OR FileExtension="pptx" OR FileExtension="pptm" OR FileExtension="odp"</KeywordQuery> <PropertyRef Name="Author" /> <PropertyRef Name="DocComments"/> <PropertyRef Name="Description" /> <PropertyRef Name="DocKeywords"/> <PropertyRef Name="FileName" /> <PropertyRef Name="Size" /> <PropertyRef Name="DocSubject"/> <PropertyRef Name="Path" /> <PropertyRef Name="Write" /> <PropertyRef Name="CreatedBy" /> <PropertyRef Name="ModifiedBy" /> <PropertyRef Name="Title"/> </ResultType> </ResultTypes></root></Properties>
</WebPart>
]]>
</AllUsersWebPart>
</File>
5.Deploy your custom solution and you will have a custom advanced search page.