0

Having a site column of type 'Hyperlink or picture" which is configured as hyperlink my requirement is to search for content in this hyperlink column in a CSOM Applet. Now I wonder

  • do I have to create a separate managed property for this?
  • which technique would be appropriate (KeyWordQuery in a javascript function or are there any jquery templates or better use REST)?
0

it works with keywordquery using the managed property which has been generated for the hyperlink column. For example to search for a specific file within a javascript applet we could execute:

function startSearch() {
SP.SOD.executeFunc("SP.Search.js", "Microsoft.SharePoint.Client.Search.Query.KeywordQuery", function () {
    var keywordQuery = new Microsoft.SharePoint.Client.Search.Query.KeywordQuery(clientContext);
    keywordQuery.set_queryText("nameOfManagedPropertyOWSURLH:http://servertest.com/librarytest/filename.docx");
    var searchExecutor = new Microsoft.SharePoint.Client.Search.Query.SearchExecutor(clientContext);
    results = searchExecutor.executeQuery(keywordQuery);
    clientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);
});

}

Finally we loop through the results delivered by the search engine

function onQuerySucceeded(sender, args) {
    $.each(results.m_value.ResultTables[0].ResultRows, function () {...});
}

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.