I've got a database. In its "tags" column, rows can have a combination
of multiple values "A, B, C"--such that:
row 1 has "A"
row 2  has "A, C"
row 3 has "B, A"

and so on, in various permutations.

I am trying to implement search using a managedQuery such that I can
return a cursor that contains rows with one or more values in the
query. For example, if the user enters "C, A" for a search, s/he
should get all rows that have A, C, or A and C.

I'm splitting the user query on the comma (",") character, and the
final call is as follows (parameters replaced by actual values):

mActivity.managedQuery("content_uri", [id, title, tags], "title LIKE ?
OR tags LIKE ?", [%A% OR %C%, %A% OR %C%], "title ASC")

Even though there are rows in the database that contain A, C, or A and
C--the managedQuery returns nothing. Thankfully, if the query is for
"A", or for "C", the appropriate rows with "A" or "C" or "A and C" are
returned. It's just that a query with more than one search term
returns nothing.

What am I doing wrong here? My guess is that %A% OR %C% is incorrect
logic, but why?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to