0

Im trying to make a search function if the user typed Jose it will match with José or jose in SQLite. When i search Jose it is not found. If the database contains 15k or 100k names making a new column converting the accent letters to not accent is not reliable.

enter image description here

enter image description here

My DBclass:

 public String search(String value)
{
    SQLiteDatabase db = this.getReadableDatabase();
    String [] arr = value.split("_");
    Cursor c = db.rawQuery("Select * from tblvoters where firstname = ? and middlename = ? and lastname = ? and birthdate = ? ",new String[] {arr[0],arr[1],arr[2],arr[3]});
    String column1 = "";

        if(c.moveToFirst())
        {
            do
            {
                column1 = c.getString(c.getColumnIndex("firstname"))+"_"+c.getString(c.getColumnIndex("middlename"))+"_"+
                        c.getString(c.getColumnIndex("lastname"))+"_"+c.getString(c.getColumnIndex("birthdate"))+"_"+
                        c.getString(c.getColumnIndex("gender"))+"_"+c.getString(c.getColumnIndex("civilstatus"))+"_"+c.getString(c.getColumnIndexOrThrow("votingcenter"))+"_"+c.getString(c.getColumnIndex("precinctno"))+"_"+
                        c.getString(c.getColumnIndex("province"))+"_"+c.getString(c.getColumnIndex("municipality"))+"_"+
                        c.getString(c.getColumnIndex("barangay"));
            }while(c.moveToNext());
        }

    c.close();
    db.close();
    return column1;
}
  • the solution you gave was not reliable because i have a data of 100k names. If i would make a new column will replace the accent that will eat alot of size. @CL – Robin Bernardo Mar 06 '16 at 08:55
  • There were three distinct solutions to the duplicate. Have you read the others? – Jongware Mar 06 '16 at 21:50

0 Answers0