Omeka icon indicating copy to clipboard operation
Omeka copied to clipboard

Search/index.php record_type sort order

Open jcmundy opened this issue 5 years ago • 8 comments

Currently in my site, the search/index.php search page seems to sort by record_type with File always coming first, and Item coming second. I just want to reverse that order so that Items come first. Is that possible? I cannot seem to locate where it is choosing the record type order. Thank you.

jcmundy avatar Apr 25 '19 16:04 jcmundy

The usual sort order for the search page is actually "relevance" to your query. It's possible that simply by containing less "other" data, the File records are being considered as more relevant.

zerocrates avatar Apr 25 '19 18:04 zerocrates

I have changed the simple (default) search to exact_match on this site, because the most common search term is excluded on keyword search. It is definitely sorting by record_type and appears to sort them alphabetically. https://repository.netecweb.org/search?query=assessment&query_type=exact_match&record_types%5B0%5D=Item&record_types%5B1%5D=File&record_types%5B2%5D=Collection&record_types%5B3%5D=Exhibit&record_types%5B4%5D=ExhibitPage&record_types%5B5%5D=SimplePagesPage&submit_search=Search If I leave off the parameters, it sorts them in a better order: https://repository.netecweb.org/search?query=assessment Is there any way to do that? Thank you.

jcmundy avatar Apr 25 '19 19:04 jcmundy

Is it possible that I did not change 'keyword' to 'exact_match' in enough places or missed something in changing over the default search (Seasons Template) to Exact Match?

jcmundy avatar May 02 '19 16:05 jcmundy

Both boolean and exact match searches order by record type, and then what appears to be date added. If I select Keyword from the dropdown, it orders by relevance as expected. Other Omeka sites that I have worked on order by relevance as expected, but in those cases I did not try to change over the default simple search to exact match.

jcmundy avatar May 02 '19 20:05 jcmundy

You get relevance sorting automatically only with natural language or "keyword" searches. Exact match uses a totally different kind of query that doesn't do relevance calculation (basically, a record either has the exact match, or it doesn't).

There's a possibility to add an extra statement to the query to get the relevance sorting anyway, but it would be using the regular natural-language search algorithm: so it would have the same issues with excluding search terms.

zerocrates avatar May 02 '19 23:05 zerocrates

It's not a general solution but will do what you want: you can explicitly sort on record_type and choose a direction, by adding sort_field=record_type&sort_dir=d to the URL (or hidden fields to that effect if you're editing the form template).

zerocrates avatar May 02 '19 23:05 zerocrates

Thank you for the help!

jcmundy avatar May 03 '19 14:05 jcmundy

Is it possible to edit the search form so that files are indexed to be searched (still checked in the admin) but by default not checked (so that if a user goes to search they don't get file results - unless they go back and check that box)?

jcmundy avatar Nov 14 '19 16:11 jcmundy