Hi Christian,

Thanks for your suggestion

> a) recursively build a query string, which will be evaluated via
xquery:eval (as proposed on StackOverflow)

on this solution i could work if i get the expected result then will
update on stackoverflow

Thanks for your time
Dharmendra kumar Singh

On Tue, Nov 15, 2022 at 7:35 PM Christian Grün <christian.gr...@gmail.com>
wrote:

> > Currently front-end not generating the search combination ( (title =
> "United States" or isbn = "2345371242192") and author ="Jhon" ) just i am
> thinking, if i could  achieve this way, so that i could ask fron-end person
> to send this way.
>
> If your frontend is JavaScript-based, it may be easier and cleaner to
> create a JSON object that contains the search fields. Something like:
>
> {
>   "AND": {
>     "OR": {
>       "isbn" : "2345371242192",
>       "title": "United States"
>     },
>     "author": "Jhon"
>   }
> }
>
> If you POST this snippet as 'application/json' to a RESTXQ backend,
> the resulting XML structure will be:
>
> <json type="object">
>   <AND type="object">
>     <OR type="object">
>       <isbn>2345371242192</isbn>
>       <title>United States</title>
>     </OR>
>     <author>Jhon</author>
>   </AND>
> </json>
>
> You can then parse this XML fragment with XQuery to either:
>
> a) recursively build a query string, which will be evaluated via
> xquery:eval (as proposed on StackOverflow), or
> b) process the query tree recursively for each element of your document.
>
> The first variant will probably be more efficient.
>
> You’ll probably need to invest some time to get this realized (I don’t
> think there’s a solution that can be used out of the box).
>
> Best,
> Christian
>

Reply via email to