[xquery-talk] Using Union/Intersect to Combine Two User-Defined Function Results

Wei, Alice J. ajwei at indiana.edu
Tue Mar 25 15:15:23 PST 2008


Hi, XQueriers:

   I am working on a search engine and right now I am making attempts to combine two sets of results using union, intersect or except operators. Here is a snippet:

 if (($search ne "") and ($search2 eq "address") and ($search3 eq "address") and ($search5  ne "") and ($search7 eq "and") and ($search6 eq "") and ($search4 eq  "head") and ($search8 eq "and"))
then <div><p>This is Your Term of Search : {$search} in &#60;{$search2}&#62; {$search7} {$search5} in &#60;{$search3}&#62;</p>
{local:count-distinct-values(collection("my")//ad//address[contains(., $search)])} intersect {local:count-distinct-values(collection("my")//ad//address[contains(., $search5)]) }
</div>
else <p>I don't know what you want.</p>

If I tried using another curly brace to surround the above statements and have my function call as in: {local:count-distinct-values(collection("my")//ad//address[contains(., $search)]) intersect local:count-distinct-values(collection("my")//ad//address[contains(., $search5)]) }

This bring me no output and no errors.

However, if I use the {local:count-distinct-values(collection("my")//ad//address[contains(., $search)])} intersect {local:count-distinct-values(collection("my")//ad//address[contains(., $search5)]) }

it gives me the first part of the query, with the actual word, intersect in between, and followed by the second portion of the query after the word "intersect."

Have I missed something here? How can I call my query and have the two results combined together?

Thanks to those who can help.

Alice
======================================================
Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
ajwei at indiana.edu



More information about the talk mailing list