Simple Search Plus

I’d like to create a site-wide search box that combines the query type options of Omeka’s simple search box with the item type options of Omeka’s advanced search.

I wonder which of the following would be smarter and more feasible:

  1. Replace echo search_form(); with $this->partial('items/search-form.php', array('formAttributes' => array('id'=>'advanced-search-form'))); Use CSS to hide the form fields that aren’t desired for site-wide display but show fields in the Advanced Search proper. Then somehow build in an ‘exact match’ query type option (is this part even possible?)

  2. Add Item Type to the Simple Search filters (adding an ‘Items’ table query)

  3. Another option I haven’t thought of

I prefer the idea of using Advanced Search site-wide because I find the (browse) results page to be more user friendly than the (search) results page.

I look forward to your thoughts!

Hi, I am also trying to archive the same. Have successfully completed it?
Can you give me some pointers to implement it with option 1?

Hi @Darp!

I prefer option 1 as well. But I haven’t looked into adding an ‘exact match’ query type to the Advanced Search. Not yet.

What you want may be pretty easily possible, at least in part, but I’m not sure exactly what you’re looking to do. You want to replace the search bar in the theme with one that goes to the Item-specific search, right?

What exactly are you thinking in terms of “exact” search? That’s already available in the “advanced” Narrow by Specific Fields dropdown, but you want something a little different I take it?

And is Item Type involved somehow?

End goal:
search box on every page that can search items only, and only the text item type, and uses a custom exact match query type.

I was thinking about replacing the search bar with the item-specific search. And giving users the option to pre-filter by item-type (from drop-down/checkboxes/radio buttons). These parts seem straightforward.

The part that I’m curious about is adding query type options to the item-specific search…

  1. I’d like to use a search that will search across all fields, rather than narrowing by a specific field. This seems doable since the keyword search is already available in the item-specific search.
  2. I’d like to give users the option to choose a keyword or an exact match search. We created a custom query type for echo search_form(); that does exact match but ignores markup (punctuation and brackets) added during transcription. Ideally we’d like to use this custom query for an exact match item-specific search. But I’m not sure how to add query types to the item-specific search.

I hope this helps?

Hi @adehner,
Do you know where I can edit the search query?
I am planning to get all the search records on the search page without pagination.
Thank you, Darp

@Darp, you can edit the number of results displayed per page in Omeka dashboard at domain/admin/appearance/edit-settings The number entered here applies to browse and search results.

I think you’d have to create a plugin to get all items on one page, here’s an old forum entry about customizing items/page:

And to customize search query types, you’d need to create a plugin.

So, for point 1, is the “keyword” search that the item-specific search does sufficient, or do you want something that works differently?

Your exact-match ignoring some things search you’d have to add I suppose, as you say. For the item specific search you’d add this query using the items_browse_sql hook.

More or less all you need to do if you want a form to use the item-specific search options is to have it submit a GET to items/browse using the same form element names as are used in the item-specific search. You can replace the search form with the search_form filter.

Newbie here… How do you ‘replace the search form with the search_form filter2’?

The “2” there is just from the forum software saying 2 people have followed that link.

As for how you’d use the filter, check out the documentation on filters, which happens to mention the search_form filter specifically.

The basic idea is that you can make a very small plugin which contains a method that will receive the current form HTML as an argument. You can add to that HTML, or replace it completely with whatever different HTML you want, and then return it from that method, and it will be the HTML Omeka actually uses for the search form.