1

I want to do following queries,

1) Multi query like

SELECT * FROM table_name WHERE username="Tom" OR lastname="Gordon" OR city="New York"; 

2) Combination of AND and OR operations. Ex:

SELECT * FROM table_name WHERE username="Tom" OR lastname="Gordon" AND age=25;
HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
smitach
  • 11
  • 4

1 Answers1

0

Multiple AND is possible using SortedMerge or ZigZagMerge. See here for documentation and here for example.

Use db.scan for OR query.

These two types of query can be combine as long as OR is top of the node, i.e, disjunctive normal form.

Unfortunately these query are not available yet in fluent Query API, so terrible to use now.

Community
  • 1
  • 1
Kyaw Tun
  • 12,447
  • 10
  • 56
  • 83
  • Thank you Kyaw for reply. I wanted to know is there any limitations on index iterators if we use NestedLoop or SortedMerge or ZigZarMerge? I tried having range iterator, but the result missed out few records. – smitach Jan 28 '16 at 05:19
  • Example: var li_iter = ydn.db.IndexIterator.where('multiQ', 'license', '>', 'SA'); var li_iter1 = ydn.db.IndexIterator.where('multiQ', 'license', '<', 'SA'); var pu_iter = ydn.db.IndexIterator.where('multiQ', 'publisher', '=', 'Nature'); var book_iter = ydn.db.IndexIterator.where('multiQ', 'book', '>', 'Boat'); var book_iter1 = ydn.db.IndexIterator.where('multiQ', 'book', '<', 'Boat'); var solver = new ydn.db.algo.NestedLoop(match_keys); //var solver = new ydn.db.algo.ZigzagMerge(match_keys); db.scan(solver, [li_iter, li_iter1, pu_iter, book_iter, book_iter1]); – smitach Jan 28 '16 at 05:31
  • @user3273859 I had add link to doc. – Kyaw Tun Jan 28 '16 at 09:31