1

Hi I managed to get refiners using JavaScript but now I am trying to get the content of each of them. This is what I have, thank you.

RefinerName
Item1 (2)
    file1.txt (Contents I am trying to get)
    file2.txt (Contents I am trying to get)
Item2 (5)
    file1.txt (Contents I am trying to get)
    file2.txt (Contents I am trying to get)
    file3.txt (Contents I am trying to get)
    file4.txt (Contents I am trying to get)
    file5.txt (Contents I am trying to get)

EDIT:

function GetRefiners() {
    $.ajax({
          url: "http://myserver/_api/search/query?querytext='*'&refiners='RefinerName'",
    type: "GET",
    headers: {
        "accept": "application/json;odata=verbose",
    },
    success: function(data){
        $.each(data.d.query.PrimaryQueryResult.RefinementResults.Refiners.results, function(index, list){
                    $('#leftDiv').append("" + "<strong>" + list.Name + "</strong><br/>");
        });
        $.each(data.d.query.PrimaryQueryResult.RefinementResults.Refiners.results[0].Entries.results, function(index, list){
                    $('#leftDiv').append("<a href='#' id='c1'>" + list.RefinementName +  "("+ list.RefinementCount + ")" + "</a><br/>");
        });
    },
        error: function(error){
            alert("Error message\n" + JSON.stringify(error));
        }
    });
}
  • Post the code which you are using – Aakash Maurya Aug 27 '16 at 10:32
  • You mean you want to get the documents that are tagged by the refiner? if that's the case then you can pass the refinementName to &RefinementFilters when calling the Search API RefinementName:equals("refiner")) – Aventus Aug 30 '16 at 6:33
  • Do you have an example please? – Ado Aug 30 '16 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.