Posts

Showing posts with the label Content Search Web Part

Sharepoint 2013 search: how to make refiner update 2 search web parts

Image
So my case today is having a nice Search Results Page, with a nice Search Results WP and a Refinement WP updating him. now i added another Content Search WP, and Oh My! it doesnt updates! since i am used to MS giving a lot of work to developers, that looked like a nice challenge, some advanced client-side Search-Controls work. so... 1 - Get the new query that part is easy - its up in the url, with a simple regex i took it out var rgx = /#Default={[{":,\\}()#\-\[\]a-zA-Z0-9]+}/ ; var queryObjStr = decodeURIComponent(window.location.hash)                      .match(rgx)[0].replace( "#Default=" , "" ); 2 - Send it to our control well, MS did gace us some nice Client-Side API, one of the SRCH objects is the QueryState, which is actually the object in the Default up in our hash var queryState = JSON.parse(queryObjStr); var queryStateArgs = new Srch.QueryEve...

How i've won MS : Sort Content Search Web Part via JS, and all other functions that should be from the QS

Image
my scenario was ordering the search results, and i really wanted to make it with CSWP, and my CTO wanted the odering via QS, so he found me this: http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2013/01/09/how-to-sort-search-results-by-query-string-with-the-resultscriptwebpart-in-sharepoint-2013.aspx that was great until it needed to be embedded with some OOTB refiners, my little script overran sharepoint's OOTB behavior since they use the QS as well, and so started the fight to find how to do it OOTB. in the beginning i found zelion posts about "Srch.U.fillKeywordQuery", which is great but i couldn't find that JSON object. i then looked into the objects on the page and found that my object was  "Srch.QueryState", but no way was found to update it and send the request. but i didn't gave up. all those posts with all those ways to refresh the "Search Content WP" made me feel that there is a way, a simple way that does not i...