On this page

Nested Index

Like in previous section, taking the same document, now let’s say we wish to index city as well so that we could search people using city. To do this we will create the nested index like this;

tbl->addIndex("address.city", 40, true); 
And now we can search using the scan_doc again for both name and city like following;
Note that joinop is 0 which means AND, see the join_operator enum in the enum section.

Therefore, the query looks like following;
scan the table where name is sachin and city is bangalore
const char *query = {
resultset *rs = NULL; scan_filter sf;
while(true) {
  rs = tbl->scan_doc(rs, NULL, NULL, query, &sf);
  if(!rs) break; while(rs->hasNext()) { 
    // keys and vals rs->
Was this article helpful to you? Yes No