Allow users to search for works and bookmarks by language short name

Description

This issue applies to the following search fields:

  • "Work Search" in the header

  • "Search within results" in the work filters

  • "Any Field" on the work search page

  • "Any field on work" on the bookmark search page

  • "Search within results" in the bookmark filters

Currently, if you'd like to search by language using any of the above fields, you need to use the syntax language_id: 1, where the number corresponds to the id of the Language in the database.

To make this more user-friendly, we'd like to make it so you can enter either language_id: en (where en is the Language short name) or language_id: 1 to get all English works. (The latter is necessary to avoid breaking bookmarked searches.)

We’ll need to reindex all works so the language_id field uses the short name. This is necessary to avoid and allow users to search for works in multiple languages, e.g. language_id: en OR language_id: zh to get works in either English or Chinese.

Note that if you use the old numerical id (language_id: 1) in your search, you should see the new short name (language_id: en) in the search field after performing your search.

How to test:

  1. Check that the language dropdown still works as expected in the work search page and on the work filters.

  2. Check that the language dropdown still works as expected in the bookmark search page and on the bookmark filters.

  3. Check that the field "Search within results" in work filters work by using the language_id hidden search operator.

    1. You can filter for 1 language with language_id: X.

    2. You can filter for multiple languages with language_id: X OR language_id: Y

  4. Repeat 3 for "Any Field" on the work search page.

  5. Repeat 3 for "Any field on work" on the bookmark search page.

  6. Repeat 3 for "Search within results" in the bookmark filters.

The hidden search operator should handle both new arguments (language short names) and old arguments (language database IDs). Here are some you can use:

en 1
ru 30
es 9
fr 8
it 13
de 7
zh 40
pl 19
pt 20
id 38
cs 5
ko 35
tr 24
hu 16
ja 36
he 33
fi 23

 

Environment

None

Status

Assignee

redsummernight

Reporter

Sarken

Roadmap

Bookmarks
Internationalization
Search
Works

Priority

Medium

Affects versions

Fix versions

Components

BackEnd

Difficulty

Medium

Required Access Level

None

Milestone

Internal 0.9
Configure