Create page layout for SharePoint 2013 search result webpart.
- Add new module in a under a project.
- Add new page with web part zone under the module and the ULR in the element.xml should be Pages.
- Deploy your solution.
- Add your web parts in your custom page.
- Open the same page in designer, now you can find the spsswc:ResultScriptWebPart tag.
<spsswc:ResultScriptWebPart runat="server"
DataProviderJSON="{"QueryGroupName":"Default","QueryPropertiesTemplateUrl":"querygroup://webroot/Pages/Dummysearch.aspx?groupname=Default","IgnoreQueryPropertiesTemplateUrl":false,"SourceID":"5ce35ddf-d563-4d32-b850-c45760c9a3bf","SourceName":"Product Catalog","SourceLevel":"Ssa","CollapseSpecification":"","QueryTemplate":"{searchboxquery}","FallbackSort":null,"FallbackSortJson":"null","RankRules":null,"RankRulesJson":"null","AsynchronousResultRetrieval":false,"SendContentBeforeQuery":true,"BatchClientQuery":true,"FallbackLanguage":-1,"FallbackRankingModelID":"","EnableStemming":true,"EnablePhonetic":false,"EnableNicknames":false,"EnableInterleaving":true,"EnableQueryRules":true,"EnableOrderingHitHighlightedProperty":false,"HitHighlightedMultivaluePropertyLimit":-1,"IgnoreContextualScope":false,"ScopeResultsToCurrentSite":false,"TrimDuplicates":true,"Properties":{},"PropertiesJson":"{}","ClientType":"","UpdateAjaxNavigate":true,"SummaryLength":180,"DesiredSnippetLength":90,"PersonalizedQuery":false,"FallbackRefinementFilters":null,"IgnoreStaleServerQuery":false,"RenderTemplateId":"DefaultDataProvider","AlternateErrorMessage":null,"Title":""}"
BypassResultTypes="True"
ItemTemplateId="~sitecollection/_catalogs/masterpage/Display Templates/Search/_Item_Product.js"
ItemBodyTemplateId="~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_CommonItem_Body.js"
ResultTypeId=""
SelectedPropertiesJson="["Title","Path","Description","EditorOWSUSER","LastModifiedTime","CollapsingStatus","DocId","HitHighlightedSummary","HitHighlightedProperties","FileExtension","ViewsLifeTime","ParentLink","FileType","IsContainer","SecondaryFileExtension","DisplayAuthor"]"
HitHighlightedPropertiesJson="["Title","Path","Author","SectionNames","SiteDescription"]"
AvailableSortsJson="[{"name":"Relevance","sorts":[]},{"name":"Date(Newest)","sorts":[{"p":"Write","d":1}]},{"name":"Date(Oldest)","sorts":[{"p":"Write","d":0}]},{"name":"Lifetime Views","sorts":[{"p":"ViewsLifeTime","d":1}]},{"name":"Recent Views","sorts":[{"p":"ViewsRecent","d":1}]}]"
ShowLanguageOptions="False"
ShowPaging="False"
ShowBestBets="False"
ShowPersonalFavorites="False"
ShowDidYouMean="False"
ShowAdvancedLink="False"
ShowPreferencesLink="False"
ShowResultCount="False"
PreloadedItemTemplateIdsJson="["~sitecollection/_catalogs/masterpage/Display Templates/Search/Group_Default.js","~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Default.js","~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Site.js","~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Word.js","~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_PowerPoint.js","~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Person_CompactHorizontal.js","~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_BestBet.js","~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_WebPage.js"]"
ShowAlertMe="False" QueryGroupName="Default" RenderTemplateId="~sitecollection/_catalogs/masterpage/Display Templates/Search/Control_SearchResults.js" StatesJson="{}" ServerIncludeScriptsJson="null" Title="Product Catalog and Datasheet" FrameType="None" SuppressWebPartChrome="False" Description="Displays the search results and the properties associated with them." IsIncluded="True" ZoneID="MainTopZone1" PartOrder="2" FrameState="Normal" AllowRemove="True" AllowZoneChange="True" AllowMinimize="True" AllowConnect="True" AllowEdit="True" AllowHide="True" IsVisible="True" DetailLink="" HelpLink="" HelpMode="Modeless" Dir="Default" PartImageSmall="" MissingAssembly="Cannot import this Web Part." PartImageLarge="" IsIncludedFilter="" ExportControlledProperties="True" ConnectionID="00000000-0000-0000-0000-000000000000" ID="g_ad4f9539_26f2_46b4_8742_b57036154af4" ChromeType="None" ExportMode="All" __MarkupType="vsattributemarkup" __WebPartId="{AD4F9539-26F2-46B4-8742-B57036154AF4}" WebPart="true" Height="" Width=""></spsswc:ResultScriptWebPart>
- Now Create another custom page under the same module.
- Add the following content under file tag in the element.xml .
- Replace the properties with available in the above content.
<Property Name="Title" Value="Product Catalog" />
<AllUsersWebPart WebPartZoneID="TopLeftZone" WebPartOrder="1">
<![CDATA[
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.Office.Server.Search.WebControls.ResultScriptWebPart,Microsoft.Office.Server.Search,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
</metaData>
<data>
<properties>
<property name="Title" type="string">$Resources:Microsoft.Office.Server.Search,ResultsScriptWP_Title;</property>
<property name="Description" type="string">$Resources:Microsoft.Office.Server.Search,ResultsScriptWP_Desc;</property>
<property name="ChromeType">None</property>
<property name="AllowMinimize" type="bool">true</property>
<property name="AllowClose" type="bool">true</property>
<property name="Hidden" type="bool">false</property>
<property name="DataProviderJSON" type="string">{"QueryGroupName":"Default","QueryPropertiesTemplateUrl":"querygroup://webroot/Pages/Dummysearch.aspx?groupname=Default","IgnoreQueryPropertiesTemplateUrl":false,"SourceID":"5ce35ddf-d563-4d32-b850-c45760c9a3bf","SourceName":"Product Catalog","SourceLevel":"Ssa","CollapseSpecification":"","QueryTemplate":"{searchboxquery}","FallbackSort":null,"FallbackSortJson":"null","RankRules":null,"RankRulesJson":"null","AsynchronousResultRetrieval":false,"SendContentBeforeQuery":true,"BatchClientQuery":true,"FallbackLanguage":-1,"FallbackRankingModelID":"","EnableStemming":true,"EnablePhonetic":false,"EnableNicknames":false,"EnableInterleaving":true,"EnableQueryRules":true,"EnableOrderingHitHighlightedProperty":false,"HitHighlightedMultivaluePropertyLimit":-1,"IgnoreContextualScope":false,"ScopeResultsToCurrentSite":false,"TrimDuplicates":true,"Properties":{},"PropertiesJson":"{}","ClientType":"","UpdateAjaxNavigate":true,"SummaryLength":180,"DesiredSnippetLength":90,"PersonalizedQuery":false,"FallbackRefinementFilters":null,"IgnoreStaleServerQuery":false,"RenderTemplateId":"DefaultDataProvider","AlternateErrorMessage":null,"Title":""}</property>
<property name="ItemTemplateId" type="string">~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Product.js</property>
<property name="BypassResultTypes" type="bool">true</property>
<property name="SelectedPropertiesJson" type="string">["Title","Path","Description","EditorOWSUSER","LastModifiedTime","CollapsingStatus","DocId","HitHighlightedSummary","HitHighlightedProperties","FileExtension","ViewsLifeTime","ParentLink","FileType","IsContainer","SecondaryFileExtension","DisplayAuthor"]</property>
<property name="HitHighlightedPropertiesJson" type="string">["Title","Path","Author","SectionNames","SiteDescription"]</property>
<property name="AvailableSortsJson" type="string">[{"name":"Relevance","sorts":[]},{"name":"Date(Newest)","sorts":[{"p":"Write","d":1}]},{"name":"Date(Oldest)","sorts":[{"p":"Write","d":0}]},{"name":"Lifetime Views","sorts":[{"p":"ViewsLifeTime","d":1}]},{"name":"Recent Views","sorts":[{"p":"ViewsRecent","d":1}]}]</property>
<property name="ShowLanguageOptions" type="bool">false</property>
<property name="ShowPaging" type="bool">false</property>
<property name="ShowBestBets" type="bool">false</property>
<property name="ShowPersonalFavorites" type="bool">false</property>
<property name="ShowDidYouMean" type="bool">false</property>
<property name="ShowAdvancedLink" type="bool">false</property>
<property name="ShowPreferencesLink" type="bool">false</property>
<property name="ShowResultCount" type="bool">false</property>
<property name="ShowAlertMe" type="bool">false</property>
<property name="IsIncluded" type="bool">true</property>
</properties>
</data>
</webPart>
</webParts>
]]>
</AllUsersWebPart>
- Now deploy the solution.
Comments
Post a Comment