Support Japanese language

This commit is contained in:
jendib 2013-08-17 02:40:28 +02:00
parent 7bb1f48464
commit 5507d4ca57
4 changed files with 6 additions and 3 deletions

View File

@ -48,5 +48,5 @@ public class Constants {
/**
* Supported document languages.
*/
public static final List<String> SUPPORTED_LANGUAGES = Lists.newArrayList("eng", "fra");
public static final List<String> SUPPORTED_LANGUAGES = Lists.newArrayList("eng", "fra", "jpn");
}

View File

@ -1,7 +1,9 @@
package com.sismics.docs.core.dao.lucene;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
@ -100,7 +102,7 @@ public class LuceneDao {
* @return List of file IDs
* @throws Exception
*/
public List<String> search(String userId, String searchQuery, int limit) throws Exception {
public Set<String> search(String userId, String searchQuery, int limit) throws Exception {
// Escape query and add quotes so QueryParser generate a PhraseQuery
searchQuery = "\"" + QueryParserUtil.escape(searchQuery) + "\"";
@ -125,7 +127,7 @@ public class LuceneDao {
ScoreDoc[] docs = topDocs.scoreDocs;
// Extract file IDs
List<String> fileIdList = new ArrayList<String>();
Set<String> fileIdList = new HashSet<String>();
for (int i = 0; i < docs.length; i++) {
String id = searcher.doc(docs[i].doc).get("id");
fileIdList.add(id);

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

View File

@ -26,6 +26,7 @@
<select id="inputLanguage" ng-model="document.language">
<option value="fra">French</option>
<option value="eng">English</option>
<option value="jpn">Japanese</option>
</select>
</div>
</div>