Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


OR in search criteria #356

krasiyan opened this Issue · 2 comments

2 participants


According to the documentation - "You can use the special 'OR' on two criterion to find messages matching either search criteria". Is it possible to use more than two criterion for a single property? For example how can I fetch all messages, which have a value of x-gm-thrid among (x, y, z, ....) - fetching all messages from multiple threads.

Thank you!


You could use something like this to generate the search query:

function makeCriteria(thrids) {
  var len = thrids.length;
  if (len === 0)
    return [];
  else if (len === 1)
    return [['X-GM-THRID', thrids[0]]];
  var ret = ['OR', ['X-GM-THRID', thrids[0]]], cur = ret, next;
  for (var i = 1; i < len; ++i) {
    if ((len - i) === 1)
      cur.push(['X-GM-THRID', thrids[i]]);
    else {
      next = ['OR', ['X-GM-THRID', thrids[i]]];
      cur = next;
  return [ret];

Just pass in an array of x-gm-thrids.


Awesome implementation :) Works flawlessly! Thank you! :+1:

@krasiyan krasiyan closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.