0

I get the impression the module works best for blog-type websites. My website's nodes have many many different (short) text fields with about 30-50 characters worth of text each. It would be incredibly helpful if I could get the search results data formatted differently. It looks like snippet is just a markup string ready to be printed. Whereas I would benefit a lot more from structured data. Let's say I search for the word "communication" then I would want data that looks more like:

 array(
  'matched_node_id' => 'xyz',
  'node_title' => 'abc',
  'matched_fields' => array(
               'matched_field_1' => 'full text for this field',
               'matched_field_38' => 'full text for this field'),
   );

This way I would be able to structure my page a lot more cleanly for my users. The data sort of resembles tabular data, and showing snippets without organization would be very unhelpful. Any ideas on how this could be implemented? Monkeying with theme_preprocess_HOOK? Perhaps a new module?

1
  • You may want to look into and/or contribute to Search API module, which offers an API to improve search (by offering more back end and different functionality). – mradcliffe Mar 15 '16 at 14:00
0

It turns out that all of this information was already available, and I just had to work within mytheme_preprocess_item_list__search_results. I had the Node objects for all the nodes that matched, and so I was able to reconstruct the render array exactly the way I wanted.

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.