SharePoint 2013 Preview transforms all your old
Search Keywords or Best Bets into Query
Rules .
So let’s create a Query Rule that fires on the exact query ‘image library’
or ‘picture library’, then promotes a result for the Image Library to the top
of the page.
First, we’ll go to the Query Rules management page. On your search center’s
upper-right-hand corner, click the gear icon, then select Site Settings.
Next, on the Site Settings page, under the Search heading, click Query
Rules. Note that you may see a Search Query Rules link under Site Collection
Administration. This happens if you’re the Site Collection administrator and
the search center is the site collection’s root site. Don’t click that one;
those Query Rules affect every site in the site collection, and for now we want
to focus only on the search center site.
Now that you’re on the Query Rules page, the first question to ask is “Where
will the user be?” For example, do you want to manage Query Rules for your
main Enterprise Search? Or for People Search? Or Video Search? Each search
experience, out-of-the-box or custom, can have its own Query Rules.
This is what we call the query’s context. You configure Query Rules
for a particular context by using that first row of dropdowns in the Query
Rules management page.
To manage Query Rules for a specific search experience, use the first
dropdown to pick the Result Source for that experience. We’ll go into
Result Sources in another post — for now, think of them as a SharePoint 2010
Federated Location plus a Search Scope. Each search experience sends queries to
a Result Source, and that source guarantees results meeting certain conditions.
For instance, People Search sends queries to the Local People Results source,
which only returns People results.
We want our new Query Rule to fire on the main Enterprise Search. That
search experience sends queries to the Local SharePoint Results source (which
includes everything SharePoint crawls except People). So choose Local
SharePoint Results from the first dropdown.
Next, click Add Rule to start creating your new rule.
Having picked a context, we just need to give the rule a name, then specify
its conditions and actions. In other words, say when this rule
will fire, and what it will do when it does. This is very similar to creating a
Search Keyword in SharePoint 2010:
1. Give the rule a name: Image Library.
2. In the Query Conditions
section, leave the condition type on “Query Matches Keyword Exactly”. In the
textbox, type the queries we want to match, separated by semicolons: image library;
picture library.
3. In the Actions section,
since we want to promote a result to the top of the page, click Add Promoted
Result. These are just like Best Bets in SharePoint 2010.
4. In the Add Promoted Result
dialog, fill out the title, URL, and description.
5. Click Save in the dialog,
then Save in the Add Query Rule page.
And that’s it…you’ve created a Query Rule! To try it out, go to your search
center and search for ‘image library’ or ‘picture library’ (note that it can
take a few seconds for the Query Rule to start working).
This Query Rule, while simple, demonstrates the high-level steps for
creating all Query Rules.
- Pick the context (e.g., queries sent to the Local SharePoint Results source).
- Specify the conditions (e.g., fire if the query exactly matches ‘image library’ or ‘picture library’).
- Specify the actions (e.g., promote a result for the Image Library).
No comments:
Post a Comment