3

I'm trying to change the result source of Content Search Web Part, but when i click on the button 'Change Query', in web part properties, the page postback and the dialog does not showing up. In browser console, i can see the error message:

Uncaught TypeError: Cannot read property 'QueryBuilder' of undefined
at Array.Search_Configuration_QueryBuilder$onLoad (http://mySite:8080/_layouts/15/search.configuration.debug.js?rev=zldCOhFvrMg2hZjkCGfP5A%3D%3D:1080:94)
at http://mySite:8080/ScriptResource.axd?d=roPHFDHMPE9qkAB7z_cY9vEvqXQ…wiWtps7ch8yBvO8RGXGUQqWQNDMpnSavOQMlmWinBGQOtw0&t=ffffffffeea0dba9:3484:23
at Sys$_Application$raiseLoad [as raiseLoad] (http://mySite:8080/ScriptResource.axd?d=roPHFDHMPE9qkAB7z_cY9vEvqXQ…wiWtps7ch8yBvO8RGXGUQqWQNDMpnSavOQMlmWinBGQOtw0&t=ffffffffeea0dba9:4978:13)
at Sys$_Application$initialize [as initialize] (http://mySite:8080/ScriptResource.axd?d=roPHFDHMPE9qkAB7z_cY9vEvqXQ…wiWtps7ch8yBvO8RGXGUQqWQNDMpnSavOQMlmWinBGQOtw0&t=ffffffffeea0dba9:4950:18)
at init (http://mySite:8080/ScriptResource.axd?d=roPHFDHMPE9qkAB7z_cY9vEvqXQ…wiWtps7ch8yBvO8RGXGUQqWQNDMpnSavOQMlmWinBGQOtw0&t=ffffffffeea0dba9:5038:31)
at HTMLDocument.check (http://mySite:8080/ScriptResource.axd?d=roPHFDHMPE9qkAB7z_cY9vEvqXQ…wiWtps7ch8yBvO8RGXGUQqWQNDMpnSavOQMlmWinBGQOtw0&t=ffffffffeea0dba9:5049:21)

I tried to add the reference to sp.dialog.js in master page, but it does not change.

Thanks in advance.

2
  • just try to add content search webpart in another page, may be some other js code is conflicting.... Commented Dec 11, 2016 at 16:37
  • I tried to change Page Layout and i noticed that proabably, some js is conflicting with code.. I can't figured out what of this... Commented Dec 12, 2016 at 10:21

2 Answers 2

0

If you don't have a E3 (or higher) subscription plan, you can't change the query of the CSWP. Check your subscription in the Admin Center.

9
  • Now I have 'SharePoint Server with Enterprise Client Access License' subscription type. Commented Dec 12, 2016 at 9:37
  • And you're having at least design permission level? Commented Dec 12, 2016 at 9:42
  • Of course, I'm having a full-control Commented Dec 12, 2016 at 9:45
  • I really can't figured out.... Commented Dec 12, 2016 at 9:55
  • I even tried to change the master page and assign it the standard 'Oslo', but it doesn't matter... Commented Dec 12, 2016 at 9:56
0

I had a separate JS script in the page where the Search results web part was present.

The code looked like this

//function Search(queryText) {
//    var d = $.Deferred();
//
//    SP.SOD.executeFunc("SP.js", "SP.ClientContext", function () {
//        SP.SOD.executeFunc("SP.Search.js", "Microsoft.SharePoint.Client.Search.Query.KeywordQuery", function () {
//            var sContext = SP.ClientContext.get_current();
//            var keywordQuery = new Microsoft.SharePoint.Client.Search.Query.KeywordQuery(sContext);
//            keywordQuery.set_trimDuplicates(false);
//            keywordQuery.set_queryText(queryText);
//            var searchExecutor = new Microsoft.SharePoint.Client.Search.Query.SearchExecutor(sContext);
//            results = searchExecutor.executeQuery(keywordQuery);
//            sContext.executeQueryAsync(
//                function () {
//                    d.resolve(results);
//                },
//                function (err) {
//                    d.reject(err);
//                }
//            );
//        });
//    });
//
//    return d.promise();
//}
//
//function SearchBind(){
//  $('#SearchButton').click(function(event){
//      event.preventDefault();
//      var searchText=$('#SearchInput').val();
//      Search(searchText).done(function(results){
//          console.log(results);
//      })
//      .fail(function(error){
//          console.log(error);
//      });
//  }); // close click
//}

After I commented it , The Change Query dialog box worked again.

I think the SOD loading of SP.Search.js again messed up the Query object. Like how loading jQuery twice in the same page unbinds all events from the first jQuery Object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.