Hi

If it possible to put a condition (if else) in where clause? If yes how?

For example I want to do :

Let $term := 'IBM'
let $searchResults := for $searchResult in cts:search(/books/book/chapter,
                                                                                
                                                                
$query,'unfiltered')
                                                                let 
$tempResult:=
                                                                                
if ($type eq $CONTAINS) then
                                                                                
   if (fn:contains($searchResult//title/text(), $term,$COLLATION) eq 
fn:true())then $searchResult else ()

                                                                                
else if ($type eq $STARTS_WITH) then
                                                                                
                if (fn:starts-with($searchResult//title/text(), 
$term,$COLLATION) eq fn:true()) then $searchResult else ()

                                                                                
     else if ($type eq $ENDS_WITH) then
                                                                                
                                if (fn:ends-with($searchResult//title/text(), 
$term, $COLLATION) eq fn:true()) then $searchResult else ()

                                                                                
                  else if ($type eq $EXACT_MATCH) then
                                                                                
                                                if 
(fn:compare($searchResult//title/text(), $term, $COLLATION) eq 0) then 
$searchResult else ()
                                                                                
                       else ()



                                                                return 
$tempResult

Instead of iterating through each result, I want to put these conditions in 
where clause, so that performance would be better.

Thanks
Pragya

**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are 
not
to copy, disclose, or distribute this e-mail or its contents to any other 
person and
any such actions are unlawful. This e-mail may contain viruses. Infosys has 
taken
every reasonable precaution to minimize this risk, but is not liable for any 
damage
you may sustain as a result of any virus in this e-mail. You should carry out 
your
own virus checks before opening the e-mail or attachment. Infosys reserves the
right to monitor and review the content of all messages sent to or from this 
e-mail
address. Messages sent to or from this e-mail address may be stored on the
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to