SharpPS.Sitecore.ContentSearch.XA 1.2.7

dotnet add package SharpPS.Sitecore.ContentSearch.XA --version 1.2.7
                    
NuGet\Install-Package SharpPS.Sitecore.ContentSearch.XA -Version 1.2.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpPS.Sitecore.ContentSearch.XA" Version="1.2.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpPS.Sitecore.ContentSearch.XA" Version="1.2.7" />
                    
Directory.Packages.props
<PackageReference Include="SharpPS.Sitecore.ContentSearch.XA" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SharpPS.Sitecore.ContentSearch.XA --version 1.2.7
                    
#r "nuget: SharpPS.Sitecore.ContentSearch.XA, 1.2.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SharpPS.Sitecore.ContentSearch.XA@1.2.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SharpPS.Sitecore.ContentSearch.XA&version=1.2.7
                    
Install as a Cake Addin
#tool nuget:?package=SharpPS.Sitecore.ContentSearch.XA&version=1.2.7
                    
Install as a Cake Tool

SXA Search API

This module does not add a new HTTP endpoint. It plugs into two existing things that back Sitecore XA's search UI:

  1. SXA's native Web API controller, Sitecore.XA.Feature.Search.Controllers.SearchController.
  2. The base SharpPS.Sitecore.ContentSearch renderer/controller (SPContentSearchController, area SPSearch), reused here with SXA's ContentPage index model and facet items.

1. Native SXA endpoint (reference)

Routed by SXA per-site as {site-virtual-folder}/sxa/{controller}/{action}, e.g. /sxa/search/results. Web API (not MVC) — query string only, JSON only.

Action Route Model binder Response
GetResults /sxa/search/results QueryModel ResultSet
GetFacets /sxa/search/facets FacetsModel FacetSet
GetSuggestions /sxa/search/suggestions QueryModel SuggestionsSet

Query string parameters:

Param Used by Binds to Meaning
q all Query search term; server truncates to 100 chars
s all ScopesIDs ,/\|-separated item IDs whose ScopeQuery field defines the search scope
l all Languages ,/\|-separated language codes
sig all Signature opaque client token, echoed back HTML-encoded
sc_site all Site site name, drives home item / index resolution
itemid all ItemID context item; drives IIndexResolver + scope tokens
g all Coordinates lat\|lng (normalized to lat,lng); presence alone flips the request into geolocation mode
o Results/Suggestions Sortings \|-separated sort fields, e.g. field1\|-field2
e Results/Suggestions Offset paging offset (int)
p Results/Suggestions PageSize page size (int), default 20
v Results/Suggestions VariantID rendering variant used to render each result's Html
f Facets Facets ,/\|-separated facet field keys to compute

Facet filter widgets (checklist/range/radius/etc.) append their own query params which SearchService.GetQuery reads independently via Context.Request.QueryString — not part of the model binders above.

Response shapes:

Type Fields
ResultSet TotalTime, QueryTime, Signature, Index, Count, Results: Result[]
FacetSet TotalTime, QueryTime, Signature, Index, Facets: Facet[]
SuggestionsSet TotalTime, QueryTime, Signature, Index, Results: Suggestion[]

GetSuggestions behavior depends on the search:define appSetting: on Lucene it's just GetResults with each result's rendered Html returned as a Suggestion.Term; on Solr it calls the native Solr Suggest handler (sxaSuggester, top 5) for real prefix suggestions.

2. What this module changes on the native SXA endpoint

SearchController.GetResults / GetFacets both call Sitecore.XA.Foundation.Search.Services.ISearchService.GetQuery(...), which depends on two extension seams — this module replaces/extends both:

Seam Replacement Config
IIndexResolver Services/BucketableIndexResolver.cs SharpPS.Sitecore.ContentSearch.XA.config (patch:instead)
resolveBoostingQuery pipeline Pipelines/ResolveBoostingQuery/* (additive) SharpPS.Sitecore.ContentSearch.XA.Service.config

BucketableIndexResolver adds two behaviors on top of stock SXA index resolution:

Behavior Trigger Effect
Per-site index override site <site> element has an indexes property matching db/lang/{shortid} or db/*/{shortid} for the context item that named index is used instead of the default resolved one
Bucket awareness context item IsABucket() and its natively-resolved index name ≠ sitecore_{db}_index prefer the already-bucket-scoped index

Boosting rule conditionsIBoostingService.BoostQuery (called from GetQuery) evaluates the site's Boosting rules; these two new conditions become available in the Boosting rule editor on a Search Scope item:

Condition Resolver Parameters Behavior
ExpressionCriteria ResolveExpressionCriteria.cs FieldName, Expression, Inverse, Value, MergeOption, Boost Builds a SearchCriteria via ISearchCriteriaExpressionBuilder<ContentPage, SearchCriteria> and merges it into the boosting predicate. Value may use the literal token SearchQuery for "the user's current search term". Expression of Any/QueryFilter supports compound field*op*value??field*op*value groups.
QueryFilterCriteria ResolveQueryFilterCriteria.cs QueryName, Boost Reads querystring param QueryName off the current request; if present, re-dispatches into ExpressionCriteria as Any (when Boost=true) or QueryFilter, using that querystring value — lets an arbitrary ?foo=bar on the search request drive boosting/filtering without a dedicated facet widget.

Net effect: both take effect transparently on every call to /sxa/search/results and /sxa/search/facets — no controller changes needed.

Rule editor items (as shipped in the package)

Both conditions ship as items under /sitecore/system/Settings/Rules/Definitions/Elements/SXA/ in SharpPS.Sitecore.ContentSearch/App_Data/Items/SP Content Search-2.1.0.zip (package → items/master/sitecore/system/Settings/Rules/Definitions/Elements/SXA/...). This is the exact text an author sees in the Boosting rule set editor, with each [macro] bound to the condition class's property of the same name:

Item ID Rule text (Rule Editor) Class
When Field with Expression Criteria {354FAA34-04C2-49D5-8477-FAE024D163B9} where the [fieldname] field [inverse] from [expression] to [value]. [mergeoption] for multiple fields. adjust boost by [boost] SharpPS.Sitecore.ContentSearch.XA.Rules.ExpressionCriteria
When request has querystring {05BB5BBF-0450-419F-BD92-21C2A97C3A12} where request has querystring [queryname]. Evaluate as boost [boost] SharpPS.Sitecore.ContentSearch.XA.Rules.QueryFilterCriteria

Macro sources (TreeList roots referenced in the rule text field):

Macro Source root Note
[fieldname] /sitecore/templates (setRootAsSearchRoot=true) pick any template field name
[inverse] {ECA3C251-B5E9-45E4-88AC-251416982556} inversion options (e.g. NOT)
[expression] {685D17B0-70AD-457D-A7C3-EB77C209E7A2} (Expressions folder — Any, IN, Date/*, Collection/*, QueryFilter, …) operator vocabulary, same package
[mergeoption] {55301020-A325-4DF2-AD8F-D32753227726} merge options
[boost] macro type Boost, default 1.1 numeric boost multiplier

SearchXADefinition.Pipeline = "SP SXA Content Search" also has a matching picklist item — /sitecore/system/Modules/SP Content Search/Pipelines/SP SXA Content Search/{9C27C599-50FC-4EAF-B018-48CC80F6ED48} — the source list for the Pipeline droptree field on the datasource template (see below).

Separate from the above: SharpPS.Sitecore.ContentSearch.XA also overlays the base SharpPS.Sitecore.ContentSearch generic search rendering (see that project's own docs/README.md for setup — duplicate Rendering/Feature/SP Content Search, matching datasource + variants) so its datasource can target SXA buckets/facets.

Class Role
Models/SearchXADefinition.cs Extends SearchDefinition with FacetItems/ScopesIDs; sets Pipeline = "SP SXA Content Search" so it resolves against the getservice/getrendering group in SharpPS.Sitecore.ContentSearch.XA.Bucket.config instead of the base module's default pipeline group
Pipelines/GetDefinition/GetFromDataSource.cs Reads datasource's Facets field (pipe IDs, filtered to items deriving from Sitecore.XA.Foundation.Search.Templates.Facet) and ScopesIDs field (pipe IDs)
Pipelines/GetService/BuildQueryable.cs Calls SXA's own ISearchService.GetQuery(SearchQueryModel) to build the base IQueryable<ContentPage> — same predicate SXA's own endpoint would build
Pipelines/GetService/BuildFacetsQueryable.cs Invokes SXA's IFacetService.BuildFacetQuery (via reflection — it's protected internal on the stock service) to apply FacetItems as facet-on clauses
Pipelines/GetService/ResolveFacetResults.cs Returns SearchXADefinition.FacetItems instead of re-resolving facets from SearchDefinition.Facets text

This gives you an alternative to SXA's JS search widgets: a server-rendered (or ?renderJson=1 / Accept: application/json) MVC rendering, driven entirely by a Sitecore datasource item, that runs against the same SXA index/scopes/facets configuration.

Datasource template

Ships in the same package as /sitecore/templates/Modules/SP Content Search/Definition/SXA Search Definition ({80684200-82FC-49DB-A026-4A6281EB4023}), based on the core Search Definition template ({EF096545-2592-4EC8-B200-1910EE93321E}) plus an XA-only Options section:

Field Section Type Source Notes
ScopesIDs Options Treelist query:$site/*[@@name='Settings']/*[@@name='Scopes'] picks the site's Scope items whose ScopeQuery field feeds SearchXADefinition.ScopesIDs
Facets (inherited from Search Definition) pipe-delimited facet item IDs, filtered to items deriving from Sitecore.XA.Foundation.Search.Templates.Facet in GetFromDataSource.cs

Standard Values preset on this template already sets:

Field Value
searchtype Sitecore.XA.Foundation.Search.Models.ContentPage, Sitecore.XA.Foundation.Search
pipeline SP SXA Content Search

— so a datasource created from this template is wired to the XA pipeline group and ContentPage index model out of the box; you only need to fill in Root/Templates/ Facets/ScopesIDs and the rest of the base Search Definition fields.

Setup

Goal How
Pin an item/bucket to a specific index Add indexes="master/en/{shortid}=my_custom_index\|..." to the site definition's <site> element properties
Use the new boosting conditions On a Search Scope item's Boosting rule set, add Expression Criteria / Query Filter Criteria alongside stock SXA conditions
Use the "SP SXA Content Search" rendering Duplicate rendering + datasource + variants as per the base SharpPS.Sitecore.ContentSearch module, then populate the datasource's Facets and ScopesIDs fields to scope/facet the query the same way an SXA Search Results component would
Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SharpPS.Sitecore.ContentSearch.XA:

Package Downloads
SharpPS.Sitecore.ContentSearch.Variants

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.7 95 8/7/2026
1.2.2 240 2/28/2025
1.2.1 211 2/24/2025
1.1.8 253 3/27/2024
1.1.7 279 11/24/2023
1.1.4.1 255 10/25/2023
1.1.3.4 209 10/5/2023
1.1.3.3 219 9/27/2023
1.1.3.2 214 9/26/2023
1.1.3.1 229 9/25/2023
1.1.3 212 9/25/2023
1.0.9.9 279 6/23/2023
1.0.9.8 295 6/15/2023
1.0.9.7 274 6/15/2023
1.0.9.6 274 6/15/2023
1.0.9.5 297 6/15/2023
1.0.9.4 288 6/14/2023
1.0.9.3 310 6/14/2023
1.0.9.2 291 6/13/2023
1.0.9.1 294 6/13/2023
Loading failed