I have words in database that contains Camp and Càmp. Now when I enter the word Camp, it should fetch and display both the words. So how to write the query to match the accented letters a and à to read the words from database.
Below is the query after passing the search text.
public List<TableOfContents> searchForText(@Nullable String rootHash,
@Nullable String substring) {
List<TableOfContentsNode> returnValue = null;
String likeQuery = null;
if (StringUtils.isNotEmpty(substring) && StringUtils.isNotEmpty(rootHash)) {
likeQuery = "%" + substring + "%";
Cursor cursor = mDatabase.query(Tables.TOC_NODES, null,
Columns.NODE_HASH + " = ? AND (" +
Columns.TEXT + " LIKE ? OR " +
Columns.TITLE_BREAK + " = 1)",
new String[] { rootHash, likeQuery }, null, null,
Columns.SORT_ORDER + "ASC");
returnValue = getFromCursor(cursor);
cursor.close();
}
Do I need to add anything in query to match both accented and normal character words? I read COLLATE NOACCENTS but i don't know where to use in above query.
Kindly help me.