I'm trying to develop a Windows Phone app which is able to search for persons in a large(300,000 persons) sqlite database. The problem is that it takes half a minute to find a person.
Do you have any idea how I could make the search faster?
Here's my code:
var queryname = conn.Table<contacts>().Where(
x =>
(
((x.firstName.ToLower() == input1) && (x.lastName.ToLower() == input2))
|| ((x.firstName.ToLower() == input2) && (x.lastName.ToLower() == input1))
|| ((x.firstName.ToLower() == input1) && (x.lastName.ToLower().Contains(input2)))
|| ((x.lastName.ToLower().Contains(input1)) && (x.firstName.ToLower() == input2))
));
var resultname = await queryname.ToListAsync();
Person1.Content = null;
foreach (var item in resultname)
{
outputname = string.Format("{0} {1}", item.firstName, item.lastName);
}
Input 1 and 2 are the two words the user has typed in.
Thank you in advance,
Nadine