Oct 10 2017 04:15 AM
I have this code:
private GetSearchresults(): void { pnp.sp.search(<SearchQuery>{ Querytext: "ContentType:TEST_matters", RowLimit: 10, EnableInterleaving: true, SelectProperties: ["RefinableString10", "CreatedBy","Created"], RefinementFilters: ["RefinableString18:equals('false')"], }).then((result: SearchResults) => { var props = result.PrimarySearchResults; debugger; var propValue = ""; var counter = 1; props.forEach(function(object) { propValue += counter++ +'. Title - ' +object.Title +"<br/>"+"Rank - " + object.Rank +"<br/>"+"File Type - " + object.FileType+"<br/>"+ "Original Path - " +object.OriginalPath +"<br/>"+" Summary - "+ object.HitHighlightedSummary + "<br/>"+"<br/>"; });
Now I want to have the "RefinableString10" field like this "object.RefinableString10". But I get an error that "RefinableString10" does not exist in "SearchResults". However, in debug, I can see "RefinableString10" which is proper filled. I suppose I need to declare something? But I do not have any clue.
Thanks, Mike
Oct 10 2017 05:29 AM
For now I added the "RefinableString10" to the "SearchResult" declaration in "search.d.ts". It works but is this the way to go? Ain't it possible to add a property to the SearchResults in the webpart.ts file?
Oct 15 2018 01:15 PM
I'm having this same problem right now with one search solution.
Did you found other way to make it work?
Oct 16 2018 10:27 AM
This is what I did to fix this problem.
First I create other Interface that extends from the SearchResult: