Locations with cyrillic charaters are not displayed in "Parent location"
Closed this issue · 2 comments
First Check
- This is not a feature request
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn't find it.
- I searched the documentation, with the integrated search.
- I already read the docs and didn't find an answer.
Homebox Version
0.13.0
What is the issue you are experiencing?
If location's name doesn't contain Latin characters, digits or symbols, this locations won't appear in "Parent location" field. As soon as any digit or symbol added to location's name it shows up in the list.
How can the maintainer reproduce the issue?
Name location just with cyrillic letters.
Deployment
Docker (Linux)
Deployment Details
Deployed on CasaOS.
I know why it's not showing up. The main reason is that the lunrjs (full-text search) component supports too few languages. When creating lunrFactory
function, unsupported languages are ignored, and the data key for inventedIndex
in lunr.Index
becomes an empty string
However, empty strings are ignored in the subsequent 'search' method, resulting in them not appearing in the result list
A temporary solution:
Add a fixed field to display
so that the key value pairs of inventedIndex
are not empty
function lunrFactory() {
return lunr(function () {
this.ref("id");
this.field("display");
for (let i = 0; i < props.items.length; i++) {
const item = props.items[i];
//const display = extractDisplay(item);
const display = "_" + extractDisplay(item);
this.add({ id: i, display });
}
});
}
Another solution:
const matches = index.value.search("*" + search.value + "*");
Replace with this code
let matches
if(search.value == ""){
//Show all Item
matches = index.value.search("");
}else{
matches = index.value.search("*" + search.value + "*");
}
This method can only achieve the use of unsupported languages for all names in the list, and cannot be used for full-text search, which still requires official support from Lunrjs.
Attachment: Lunrjs supports languages