Smart Search result transformation for custom table

Keith Donnell asked on January 8, 2018 18:20

I am trying to wire up a smart search results page, where the search index is populated with custom table data. The issue I'm having is I have absolutely no way to get at the Url (which is stored in its own column).

Per https://docs.kentico.com/k11/configuring-kentico/setting-up-search-on-your-website/using-locally-stored-search-indexes/displaying-local-index-search-results-using-transformations, we only have access to a limited set of data, which is specified by the search fields we configured for our given custom table. Everything else I've read says you need a custom transformation method in order to get at any other data, but from what I can tell, we don't even have any sort of unique identifier to use in order to get this from, say, the CustomTableProvider.

In general, how can we access columns beyond those set in the search fields, within the context of a smart search result, when dealing with a custom table (or other non-page object)?

Correct Answer

Peter Mogilnitski answered on January 8, 2018 18:46

What you need is to make your URLColumn searchable thus it will be automatically added to the search index. To access it in transformation transformation you just do <%# GetSearchValue("URLColumn") %> The idea is to have all the columns that you need for rendering of search results in the smart search index. You can access columns that are not in the index in a transformation without putting them into index, but it will be inefficient (essentially the system will run a SQL query to get a value). So basically go to Custom Table/CustomTableName/Search Fields and check your URL field Image Text

1 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.