How to handle space in projection list value of RS

2019-09-05 06:11发布

问题:

I have a scenario where I need filter data using RSQL. I need to get specific columns hence using $projection=field_list=in=(FAMILY Id) But as the column here "FAMILY Id" has a space , its throwing below error.

cz.jirutka.rsql.parser.ParseException: Encountered " <UNRESERVED_STR> "Id "" at line 1, column 23.

Was expecting one of:

<OR> ...
")" ...

If I pass the same in single quotes it would work , like $projection=field_list=in=('FAMILY Id'), but is there any other way to handle the same , as i have few more scenarios in the similar way where putting the same in single quotes too does not work.

Thank you.

~Shyam

回答1:

It’s clearly stated in the documentation:

Argument can be a single value, or multiple values in parenthesis separated by comma. Value that doesn’t contain any reserved character or a white space can be unquoted, other arguments must be enclosed in single or double quotes.

field_list=in=(FAMILY Id) is invalid, so you must use single or double quotes. There’s no any other way, I believe that quoting is sufficient for all the cases. Well, except you have both single and double quotes inside an argument – RSQL currently doesn’t specify any escape character.