Hi everyone,
My first blog post on sharepointblogs.com is about an issue I came by this week.
Typically, if you create a new SharePoint Site based on the Search Center template (under Enterprise), you get a teamsite with a few prefab pages: default.aspx, advanced.aspx and results.aspx. By default, the advanced page houses the Advanced Search Box web part, which is configured to show its results on the results page. The results page houses, among some other web parts, the Search Core Results web part which is responsible for rendering the search results.
A customer asked us if it was possible to put these two web parts on the same page, so the search results would render below the advanced search form. If a user then wants to refine his search query he wouldn't have to go back to the previous page. "That's easy", you might think, and at first it did seem quite trivial:
Just put the Core Search Results web part to the advanced page, together with one or two Search Paging web parts. Then configure the Advanced Search Box web part to show results on the advanced page instead of the results page (Results URL property) and you're done.
Though the above described steps might make you think you've done it, and it might even show the correct search results in your first test run, be aware that if you're starting to use the Result Type selection, all of a sudden it's not "all good". Somehow, putting the Advanced Search Box web part on a page together with the Core Search Results web part makes it hard for SharePoint to remember what the user selected as Result Type. Check out this example:
-
A user types "Microsoft" in free search text box "All of these words:"
-
The user selects "Word Documents" as a "Result type", because he/she only wants to see Word documents with the term "Microsoft" in it
-
The user clicks the Search button
-
The system at first shows correct results (of course items should be available in the system for results to come up)
-
But by clicking the Search button again, or by navigating to the next Page in case of a big search result set, the Result Type selection all of a sudden is ignored. Now all items that contain the term "Microsoft" in it.
Is it a bug? Is it a feature? What causes this wicked behavior?
To be honest, I don't really know, but I think it has something to do with the javascript blocks and hidden form fields that are rendered by the web parts. I haven't done any thorough research so I'm not sure. This post is just a warning in case you think of customizing your search center in the same way I did. If anyone out there has something to add to this, maybe even has a solution, please let me know!