4

I got a default message from sharepoint search as like:

"No results are available. Either no query is specified, or the query came from advanced search (Federated Webparts do not support Advanced Search queries)."

And I want to change the wording with more user friendly way. Which part should I take a look?

  • What are you trying to do when you get this message? – LFurness Dec 6 '12 at 20:46
4

Sanghoon,

this message comes from resource file embedded into assembly

microsoft.office.server.search.intl.dll

and for Core Results web part this message renders when Query Error occurs instead of displaying actual search result, this is why for message XSLT customization could not be applied as for regular search results.

But it could be customized on the client side, for example the script below (jQuery is used here) changes this message:

$(function() 
   { 
       var srchErrorLabel = $('.srch-wperror').find('span');
       srchErrorLabel.text('Place user friendly message here'); 
   })

So, if you add on page where Core Results web part is located this script, the message

Place user friendly message here

will be displayed.

Hope this helps,

Vadim

1

Edit the Results page, look for the Core Results Web Part, Edit that (to bring up the toolpane), locate the XSL Editor in the toolpane, and find the text you want to edit in the XSLT (copy/paste it into Notepad for easier editing) and save it back in.

Plenty of tutorials on the web for doing it, here's one:

http://www.c-sharpcorner.com/UploadFile/Roji.Joy/how-to-customize-search-results-in-sharepoint-2010/ (skip the Fetched Columns bit)

You can find others by searching the web for 'Customise SharePoint Core Search Results web part xslt'.

1

There is a simpler way if you:

Export the web part and save it as a .webpart file Find the following line

<property name="EmptyMessage" type="string></property>

and change it to

<property name="EmptyMessage" type="string> </property>

Delete the web part from the page Import your changed .webpart file.

Why does this work?

Because the check in the html control file for the empty message is for an empty string. If the Empty message has anything in it (like a space) then that will be displayed instead.

Enjoy

Sebastian

0

This only works on the initial page load. You can implement the error message in the xsl for this web part: Change the last div of <xsl:template name="dvt_1.empty"> (<div class="srch-results" accesskey="W"> to be your error message:

<div class="srch-results" accesskey="W">
  <span class="srch-description2" id="CSR_NO_RESULTS">
   <p>Your error message here...</p>
  </span>
</div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.