How to modify MySQL results?


#1

Hey,

I am interested in possibly changing the behavior of how the MySQL search results are getting sorted. Where in the Omeka code would I look to see how this is currently working? Right now, the expected behavior does not seem to be working for me. I am expecting that a search hit will rise to the top of my results list if the search string exists within the item’s title. However, this is not happening and I am trying to figure out why and/or how to fix it. The expected behavior rings true for other sites I manage. The problem site does have quite a bit of full-text in a field. Not sure if that could be causing an issue in some way.

Thx.

–Eric


#2

The first question is: which type of search are you talking about? There’s an older item-only search or advanced search, which provides all sorts of filters on things like specific fields and so on, and the much simpler “site-wide” search. I assume you’re talking about the latter, since it’s the only one that would sort by relevance, but we really just rely on MySQL’s default behavior there.


#3

Yes, you are correct. I’m referring to the site-wide search as keyword. I am expecting that it will sort by relevance and that those items with the search term or phrase in the title will sort to the top of the list. This is not happening which is the main issue. Is my expectation for the desired behavior incorrect?

Thx.

–Eric


#4

Hey. One thing I may be noticing is that the sorting seems to fail when there are a lot of hits/records found. Is there any kind of limit set to how many results records can be sorted by the relevance method?

Thx.

–Eric


#5

You can read up a little on how MySQL works in this area but the bottom line is that the “relevance” score is very simplistic. In general I’d expect results that use the searched term more often to sort higher, as well as items that simply have less total text in them (so that the matched term is a greater “share” of the text).