Change Default Search Query in a Theme?

Hi Omeka community,

This may be a noobie question, but I have looked high and low for the answer, so it may be usepful to have this in the forum.

I have a site with thousands of items that refer to street addresses. On my resource template I have a special field for sort order which is the street name concatenated with a zero padded house number, so that 3 Cambridge street comes before 1000 Cambridge St.


Theoretically, I could change the default search query to order by this field. This is the sort order that makes most sense.

My questions:

  1. What are the files and values I should be looking to adjust to accomplish this?
  2. Is this something I can do in a Theme?
  3. Or is it necessary to write a module to over-ride the default search query?
  4. Or (for a php challenged hacker) can this be accomplished with javascript calls to the Omeka-S API.

Thank you!

Demo site: Cambridge Digital Architecture Survey and History.

You’re looking to change the sorting for this one what page? Just the browse pages?

One common solution to this is to use the Navigation config to do it, as you can add parameters to the Browse page entries there, which let you set sorting. You look like you’re not really doing browses in the navigation so this might not be the route for you. Similarly sorting can be set in the Browse preview blocks which it looks like you’re using in a few places, and also in any manual links to browse pages that you might be using.

These all involve just putting in the query string for the sorting into the URL. To change the default that’s used when there’s no query string, that currently involves a module. We have an upcoming feature in the pipeline to allow changing default sorting just through the admin interface, though.

Thank you John.
Sorry my question was not clear. What I would like to find is the location where I can change the query that is used by the Omeka-S search tool. If I could change the sort order in this query, that would be great. But it would also be great if I could cause it only to search on items having a particular resource template – or other sorts of filters.

After some more looking around. I now understand that SearchController.php is involved. I gather from the page on Theme Modifications That themes don’t override controllers (like what you said.) I’ll try making module that hacks SearchController.php. Any other hints you can provide are welcome.

I’m glad to hear that you are working on configurations for the search interfaces. I’ll take a look at the AdvanceSearch module, too.

Enjoy the weather.

Thanks again.

Or maybe I’ll try the AdvancedSearch plugin.