Site-wide search, any chance to refine it?


I would like to create a faceted-search plugin, available whenever any result is returned by the site-wide (simple) search, offering a way to further filter results.

A faceted-search is doable (actually, is already done by some developers) for advanced search, but the simple search is normally returning more results (including Collections, Files, Exhibits, etc.) so that makes it more useful/interesting for some cases (besides, users tend to use that more than the advanced search).

I was wondering whether there’s any way to hack the simple search’s query string, and to set specific values for specific fields; or maybe whether the search function would have to be rewritten, to allow for filtering results by field.

Any suggestion will be appreciated, thanks.

The trouble with refining is that the site-wide search happens against its own table, which pretty much just has the fulltext and nothing else for each searchable record: it doesn’t know anything about specific fields or anything like that. So to do a search that does both the fulltext and more “advanced” type filters you’d have to be looking at joining from the search_texts table to the items, collections, element_texts, etc. tables (and then you start to have issues with doing so and searching across multiple types at once).

Certainly you can’t do it with just query string changes to the simple search.

I see what you mean, John: the table search_texts only contains only the record type and whether it’s public as additional information.

@gsoules has managed to solve the problem in his AvantSearch plugin by rerouting the search to a different page, I guess that’s the only way to do it… :frowning: