worldskills / worldskills-infrastructure-list

WorldSkills Infrastructure List
3 stars 1 forks source link

supplied item autocomplete improvements #45

Open PierreAnctil opened 6 years ago

PierreAnctil commented 6 years ago

Today when one is creating a requested item and types "table" in the description, many items are suggested but not "Table" even though the item is in the catalog.

The reason is there are many results and their number is limited.

The autocomplete should favor exact matches and then "starts with" matches and at last the "contains" results.

Furthermore the search should only be done on the current language.

@worldskills/geeks @WorldSkillsFrance

fabian commented 6 years ago

I fixed part of this - the search is now done in the current language.

Simon-Woirgard commented 6 years ago

Ok great, what is still have do be done ? Did you push in staging and/or production ?

fabian commented 6 years ago

The following still needs to be done, but I understood it has less priority?

The autocomplete should favor exact matches and then "starts with" matches and at last the "contains" results.

I pushed it to staging and will push it to production tomorrow.

Simon-Woirgard commented 6 years ago

As discussed with Adam Skype, this is important for us. This will prevent the addition of existing lines in the catalog when adding an item in the requeste item.

fabian commented 6 years ago

@WorldSkillsFrance Can you provide an example where you see the problem happening?

fabian commented 6 years ago

Could be because there's a limit on the results or because it has the wrong language (locale) key in the database.

fabian commented 6 years ago

I noticed the values for "Table" in the database have the language key fr_FR. I assume this happened before we adjusted Accept-Language in https://github.com/worldskills/worldskills-infrastructure-list/pull/37.

I have now manually fixed the Table:

UPDATE i18n_value SET lang_code = 'fr' WHERE lang_code = 'fr_FR';

However this doesn't seem to be the issue, as the table is still not found.

Unfortunately there is a limit of 25 items on the search and just removing it would cause performance issues.

Searching for matches which have the search query at the beginning also wouldn't be a good solution as that would make it less likely for someone to find an existing matching item, if they start the name with something else.

Searching for matches at the beginning first and then for matches in the middle of the work also doesn't solve the problem in the case there are more than 25 items with the query in the beginning.

A good solution would be to add a proper search with Lucene but that would require quite some development.

A quick solution might be to increase the limit to 100 items for now.

azanetti commented 6 years ago

I think we should go for 100. What do you think @WorldSkillsFrance?

fabian commented 6 years ago

Okay, limit increased to 100.

Simon-Woirgard commented 6 years ago

Thx Fabian, this is good for the moment. The best would be :