I have over 300 000 records in rethinkdb in document "car" in database "db". When I try to do "widlcard search" with filter for property "name" it takes forever to load. This is code:
r.db('db').table('car').filter(r.row('name').match("(?i).\*"+search_string+".\*"))
where search_string
is some part of "car" name.
This is working but most of the times it takes forever (and I mean forever).
Now I have created secondary index on document "car" for property "name" but I do not know how to use that "wildcard" search on getAll.
r.db('db').table('car').getAll(r.row('name').match("(?i).\*"+search_string+".\*"), {index:"name"})
this is not working of course.
On this url: https://rethinkdb.com/blog/1.6-release/ I found this:
// Create a secondary index for all users whose first names begin with `S`
r.table('users').indexCreate('starts_with_S', r.row('first_name').match('S.*').ne(null))
// Efficiently get all the users where `first_name` begins with `S`
r.table('users').getAll(true, {index: 'starts_with_S'})
but I do not know how that can help. I think it is just mad to create index for each search on "name".
When full string is matched, of course, getAll on my index "name" is working but that is not really what I am asking for.
I can see a lot of people have same problem.
Any solution maybe?