Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Parser drops statement if it is and AND after OR #23

Closed
RuslanZavacky opened this issue Apr 11, 2017 · 1 comment
Closed

Parser drops statement if it is and AND after OR #23

RuslanZavacky opened this issue Apr 11, 2017 · 1 comment

Comments

@RuslanZavacky
Copy link

If we have the following GQL - author:joe,author:doe+tag:photo, when parsing, GQL will drop the last clause, resulting into:

{
   statements:[
      {
         op:'=',
         value:'joe',
         prop:'author'
      },
      {
         op:'=',
         value:'doe',
         prop:'author',
         func:'or'
      }
   ]
}

But if you'll go opposite way, by swapping it tag:photo+author:doe,author:joe, it will parse correctly:

{
   statements:[
      {
         op:'=',
         value:'photo',
         prop:'tag'
      },
      {
         op:'=',
         value:'doe',
         prop:'author',
         func:'and'
      },
      {
         op:'=',
         value:'joe',
         prop:'author',
         func:'or'
      }
   ]
}

Code used

const gql = require('./lib/gql');

console.log('author:joe,author:doe+tag:photo', gql.parse('author:joe,author:doe+tag:photo'));
console.log('author:joe,author:doe+(tag:photo)', gql.parse('author:joe,author:doe+(tag:photo)'));
console.log('(tag:photo)+author:doe,author:joe', gql.parse('(tag:photo)+author:doe,author:joe'));
console.log('tag:photo+author:doe,author:joe', gql.parse('tag:photo+author:doe,author:joe'));

Is it a bug, or intended behavior? Any thoughts?

Thank you!

@kirrg001
Copy link
Contributor

Hey @RuslanZavacky 👋

I'm very sorry that you haven't got a reply. If this is still an issue, could you please raise an issue here. Thanks 🙂


GQL was replaced by NQL. GQL is deprecated now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants