Search for kanji and reading together
app/src/main/java/eu/lepiller/nani/dictionary/JMDict.java
332 | 332 | ||
333 | 333 | logHuffman(readingHuffman, new ArrayList<Boolean>()); | |
334 | 334 | ||
335 | + | // Search in Japanese, by kanji and reading | |
335 | 336 | ArrayList<Integer> results = searchTrie(file, kanjiTriePos, search); | |
336 | - | if(results == null || results.isEmpty()) | |
337 | - | results = searchTrie(file, readingTriePos, search); | |
337 | + | ArrayList<Integer> readingResults = searchTrie(file, readingTriePos, search); | |
338 | + | if(results != null && readingResults != null) | |
339 | + | results.addAll(readingResults); | |
340 | + | else if (results == null) | |
341 | + | results = readingResults; | |
342 | + | ||
343 | + | // Search in other language, by meaning | |
338 | 344 | if(results == null || results.isEmpty()) | |
339 | 345 | results = searchTrie(file, meaningTriePos, search); | |
340 | 346 |