Requirement
we would like to bring support for contains operator in cps-path.
contains() is a method in XPath expression. It is used when the value of any attribute changes dynamically, below are the examples,
Reference
Issues & decisions
# | Json Data | Syntax | Decision |
---|---|---|---|
1 | Below is the sample data , Here are ways to use contains keyword : { | 1. <cps-path> ( contains '[@leafname,' <string-value> ']' ) Examples
|
Query format for contains keyword
# | Query | Output |
---|---|---|
1 | cpsdb=# SELECT * FROM FRAGMENT WHERE anchor_id = 4 and attributes->>'lang' like '%en%'; | 155 | /bookstore/categories[@code='01']/books[@title='Feersum Endjinn'] | {"lang": "en", "price": 895, "title": "Feersum Endjinn", "authors": ["Iain M. Banks"], "pub_year": 1994} | 4 | 154 | 5 | |
2 | cpsdb=# SELECT * FROM FRAGMENT WHERE anchor_id = 4 and attributes->>'pub_year' like '%99%'; | 153 | /bookstore/categories[@code='02']/books[@title='The Golden Compass'] | {"lang": "en", "price": 699, "title": "The Golden Compass", "authors": ["Philip Pullman"], "pub_year": 1995} | 4 | 152 | 5 | |