I would prefer to see search results grouped by node types (e.g. articles and forums). Is there a way to do it?

Once the results are grouped, I would even like to set the sort order of the groups similar to the sql below

SELECT *
FROM results
ORDER BY
CASE type
WHEN 'articles' THEN 1
WHEN 'forum' THEN 2
ELSE NULL
END,
node_type

If this required code modification, that's no problem. Just give me hints where to look.

Comments

markus_petrux’s picture

Current implementation of this module does not have options for grouping search results by content type. However, it allows users to filter by content types, taxonomies and node authors (depending on indexer configuration options enabled in module settings panel). It also provides a faceted search block (Guided search) that may help users refine search results by these concepts.

If you wish to group results, then it would require custom development. I can think of 2 different methods:

1) Implement a different search page that performs 2 different search queries and then adjusts the search results output to match your grouping conditions.

2) Implement 2 different search pages (maybe using separate tabs), one for "articles", and another one for "forum topics". Here you would have to build your own advanced search form for each page where you could expose only the relevant filters for each page, and also inject predefined filters for each page before running the search query methods.

You would not need to modify sphinxsearch module code. It would be possible using a custom module that reuses sphinxsearch module code.

markus_petrux’s picture

Status: Active » Closed (fixed)

Assuming that you could sort this somehow. Feel free to reopen if you need a hand.