Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is there a way to automatically add a string in front of the keyword user is searching for in SharePoint 2010 Enterprise Search?

Example:

Say user is searching for "Books". I want to automatically add "My Favorite" in front of the searched keyword every time, so in this case the search has to be done for "My Favorite Books".

The search results should show results for "My Favorite Books" and not "Books".

share|improve this question

4 Answers 4

The Core Results Web Part has a property to "Append Text to Query" in the Results Query Option. The keywords My Favorite can be added there, though it may result in a search query of "Books My Favorite" it should still produce helpful results.

share|improve this answer

Not done this before but if you can find the search page and quite sure its using dome XSL. and then modify the xsl to suit what you are after. Hope this helps Patrick

share|improve this answer

XSL just format the XML search result. At that moment, your search query already happened. I would probably inherit the OOTB search box webpart or create a custom webpart which renders a texbox and a button.

Make use of the SharePoint search querystring parameters to build your search query. Here's a list of some querystring parameters you can use. In the click event of the button:

  • Read the user input in the textbox
  • Concatenate with your extra keyword
  • Redirect to search result page with the given keywords
share|improve this answer
    
Can I do the same to add Property Restriction Keywords like Title:, FileName:, Author: in front of the searched keyword, or is there another way OOTB? –  SPJack Oct 10 '11 at 1:13
    
Yes, that way you can place every keyword or keyword combination in front. Mikes solution is also an option but it appends text to the query - not 100% the thing you want, but as said... it might be helpful. –  Sven Gillis Oct 10 '11 at 17:55

How about creating a new Search Scope and name it My Favorite? (Depending on your search settings of course)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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