My 2 search bars have different results

My Emiglio-themed Omeka site has 2 search options.

Search bar 1: a box with a magnifying glass at the top right.
Search bar 2: a “Search Items” button on the “Browse Items” page.

I find this confusing, especially because Search Bar 1 doesn’t work as well. For example, when I input “hay” to search for this photo of a “Hay baling crew,” Search Bar 1 can’t find it.

I think the improvement I want to make is to remove Search Bar 1. Please help me to do it, or share your suggestions.

Search bar 1 is the “full text search” which can find things other than items (like other kinds of pages) and uses a more efficient kind of searching. This search has restrictions that come from MySQL, and one that people hit often is that there’s a minimum length of words it will consider in the search: by default it’s usually 4.

Search bar 2 is the older item-specific “advanced” search which has more options and uses a different kind of search that tends to be slower but doesn’t have the same restrictions. For many sites the speed difference doesn’t matter.

You could hide the “search bar 1” with CSS using the CSS Editor (the relevant selector is #search-container) or by editing your theme to just take it out of the layout completely. You can also change MySQL’s settings to allow shorter words in queries to take effect there.

Thank you, I will use your code to hide Search bar 1. I wish I could put Search bar 2 in its place, but that’s probably asking too much.

However, Search Bar 2 is also problematic. It only finds exact phrases. Entering keywords “hay” and “crew” won’t find “Hay baling crew.” But entering “Bali” will, because Search Bar 2 doesn’t distinguish between letters and whole words.

Search Bar 2 still seems better than Search Bar 1, which can’t find an exact phrase. Entering “hay baling crew” in Search Bar 1 finds every Item with any of those words (except “hay,” of course).

Can I improve Search Bar 2, or get a better search bar? It seems like common sense to have one that will only find Items with ALL the keywords I enter in ANY order.

Hi @jflatnes, this question is really important to me. Can you please respond to it?

Not really… the simple search in the items advanced search is very simple and doesn’t provide you with many options.

You can modify “search bar 1” to improve it: you can turn off everything but items (that’s in Search settings) and you can alter the minimum word length to pick up more words: but changing that is a little involved, the setting is ft_min_word_len and has to be set in the MySQL server configuration. You could also change the engine of the search_texts table to InnoDB, which has some improvements to how fulltext search works. There’s also an “advanced” option for search bar 1 for doing exact match searches.

Hi @jflatnes, I raced to get my images up without considering this problem. I’m in shock. How can Omeka be an archiving software with such a faulty search engine, and one that doesn’t work like the Google search engine that we’re all used to?

I’m interested in your MySQL corrections, and I’ll try to implement them. How do I get the “advanced” option for Search Bar 1?

There’s often a “plus” or “three dots” button next to the main search bar that will show the advanced options. In some themes there’s a theme setting controlling whether that button is shown. The admin-side Search settings also let you set some of those “advanced” settings by default.

On the subject of Google, there’s always the option of just literally using Google for search, through a custom search widget or otherwise. As long as the content you want to search by is visible so Google can index it.

Thanks @jflatnes. I toggled on the “Advanced Site-wide Search” option and now I see those 3 dots. I’m not sure how much that helps. I clicked them and selected “Query Type: Keyword,” then entered “Topanga.” The search showed 0 results, even though “Topanga” is the most common word in my archive. How can anybody use this search engine? I have already started to use Google instead, after noticing that my Omeka site was getting indexed there. How can I create a custom search widget, or add some other method, to use Google for searches on my site?

The “Keyword” choice there is the default: so it doesn’t change anything. I believe the context of your previous question was how to get exact search there, and exact search is one of the advanced options.

As for “Topanga”: the other main restriction on the keyword search from MySQL is that any terms that appear in over 50% of your items will be ignored. This doesn’t apply to the “boolean” or “exact” modes. Consider also that for truly extremely common terms that appear in every or almost every item, users may realistically not actually search for them, and “Topanga” may fall into this category for your site.

You’re right that turning on the Advanced Search helped because it added the “Exact Search” option. Thanks for the explaining the “over 50%” Keyword rule, yet another frustrating limitation of the Omeka search. I’d rather try your Google search option, if you can tell me how to do it.

Google’s Programmable Search Engine is probably what you would be looking for to use Google. There are downsides (for one, ads).

The “50%” problem is not present when doing the “boolean” type search either, which might be useful for you. One other option could improve both the “word length” and “50%” issues: you can convert the search_texts database table to InnoDB: the newer InnoDB fulltext search doesn’t have the 50% limitation and allows shorter words by default.

Is there a downside to converting to the newer InnoDB?

There shouldn’t really be a downside, no. The reason we use the older (MyISAM) setup is that it’s compatible with older versions of MySQL. Fulltext indexing on InnoDB requires MySQL 5.6.4 or higher (or MariaDB 10.0.5 or higher). Omeka S, which has higher system requirements than Classic, uses an InnoDB fulltext index.

You can (and should) always take a backup when modifying the database.

Hi @jflatnes, I haven’t had time to work on this until now. How do I change the search engine to InnoDB?

In a MySQL client you can run the query ALTER TABLE omeka_search_texts ENGINE = InnoDB;

Your host may have a graphical interface option for doing this also (PHPMyAdmin for example lets you change a table’s engine in its “Operations” tab).

I only know how to edit my site through Omeka and through my Control Panel. What do you mean by “a MySQL client”? Where would I locate “PHPMyAdmin”?

Control Panels usually contain a section called Database, and that section might contain a graphical interface as John was suggesting. One of the most common is PHPMyAdmin, so you could look for it in your Control Panel.

PHPMyAdmin is quite intuitive, but should you need instructions you can find the latest ones here:

Hope this helps.

Thank you! I found PHPMyAdmin, but there’s no tab called “Operations.” There is a tab called “Engines,” and when I click it I see InnoDB listed as 1 of 8 “Storage Engines.” When I click “InnoDB,” I see “InnoDB is available on this MySQL server” and a long list of “Variables.” I’m stuck again!

The “Operations” tab I referenced is present when you’re viewing a specific table.