Searching SimpleDB in a case-insensitive way
Since Amazon SimpleDB doesn't provide case-insensitive query, what w'd be the best way to do a case insensitive search for attributes in simpleDB ?
One thing that can be done is including a separate attribute that is the lowercase version of each string, and then use a 'like' query but it will involve a lot of duplica开发者_开发问答tion.Is there any elegant way to do the same ?
EDIT
I first tried keeping a separate attribute that was the lowercase version of text to be searched, and then used 'like' query, but the 'like' is not really fast enough for stuff i'm building and also the idea of adding redundant data and complexity to the application is not cool. So i integrated elasticsearch, and it is working quite fine so far + this gives more control over search.I've heard some people advocate the separate attribute idea and I agree that's probably the best solution. Just one of the drawbacks of leaving so much functionality in the application code I guess.
You could create a entire seperate domain which is a lowercase mirror of the real data. This search domain can also have other optimizations in it.
Then try to keep the two DBS in sync. Every so often you can toss the search domain and rebuild it. You can also rebuild the search domain when you come up with a new search strategy.
精彩评论