1

I have set up a Solr index for user profiles on my site with the Search API Solr Search. The profiles are pretty complicated-- several relations, lots of fields, and many theme templates to render them with complex logic.

I am trying to speed up the performance of my search views, and I found this option under Data alterations on the Solr index:

Complete entity view

Adds an additional field containing the whole HTML content of the entity when viewed.

I thought I could use this as a cache by saving the rendered HTML to Solr for the user profiles, and then, in my view, I could just display this one item, the complete entity view, instead of having to configure all my fields and views formatting templates.

So, I did the following:

  1. At /admin/config/search/search_api/index/MYSEARCH/fields, I selected the field for indexing (complete entity view) as fulltext.
  2. At /admin/config/search/search_api/server/MYINDEX/edit, I turned on "Retrieve result data from Solr" as noted in this D.O post.

When I do this, I can now select the "Complete entity view" under Fields in the Views UI, but no result (no HTML output) is returned in the display. How can I add the output of the "Complete entity view" in Views?

1

This should be possible. I did the same thing with Search API + Elastic search (No Views module though). And yes it did speed up the results. However, in retrospect I may have been better of using Render Cache module in conjunction with an object cache like Redis and or Memcache.

The main pain point that I ran into doing full storage of HTML in the search server was that nearly every theming/template change required rebuilding the search index.

All that being said, if you want to keep going down this route I suggest using Solr's built in inspection tools to first validate that the user profile HTML has made it into Solr at all.

  • In my case, there are basically no theme changes, so it's fine if I have to rebuild the index every time. – Patrick Kenny Apr 2 '16 at 5:46
0

I had to clear the Drupal cache several times, but after doing so, I was able to index items as described in my original question.

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.