Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv14303/compiler/algebra

Modified Files:
      Tag: M5XQ
        logical.c 
Log Message:
propagated changes of Thursday Nov 05 2009 - Monday Nov 09 2009
from the development trunk to the M5XQ branch

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/11/05 - singhan: compiler/algebra/logical.c,1.129
  XQuery full-text search support initial version!
  
  This initial version provides support to
  
  -ftcontains keyword,
  
  e.g., for $f in doc("menu.xml")//food[./name ftcontains "Belgian Waffles"]
  return $f
  The above query will return all the food nodes that has some relevancy over 
"Belgian Waffles"
  
  -initial score variable support
  
  e.g., for $f score $s in doc("menu.xml")//food[./name ftcontains "Belgian 
Waffles"]
  return $s
  The above query will return the relevancy score of all the matched food 
nodes, however since its an initial version, the support to this score variable 
is very limited.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: logical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/logical.c,v
retrieving revision 1.123.2.5
retrieving revision 1.123.2.6
diff -u -d -r1.123.2.5 -r1.123.2.6
--- logical.c   7 Oct 2009 14:22:31 -0000       1.123.2.5
+++ logical.c   9 Nov 2009 00:03:08 -0000       1.123.2.6
@@ -605,7 +605,7 @@
 
     /* indicate what kind of internal operator we are working on */
     ret->sem.eqjoin_opt.kind   = la_cross;
-    
+
     /* copy schema from argument 2, check for duplicate column names
        and discard if present */
     for (j = 0; j < n2->schema.count; j++) {
@@ -800,7 +800,7 @@
             i--;
         }
     }
-    
+
     /* copy schema from projection list 'rproj' */
     /* discard join columns - they are already added */
     for (i = 1; i < PFarray_last (rproj); i++) {
@@ -1241,17 +1241,34 @@
             kind == la_difference);
 
     /* see if both operands have same number of columns */
-    if (n1->schema.count != n2->schema.count)
-        PFoops (OOPS_FATAL,
-                "Schema of two arguments of set operation (%s) "
-                "do not match. (%i #cols != %i #cols)",
-                kind == la_disjunion
-                ? "union"
-                : kind == la_intersect
-                  ? "intersect"
-                  : "difference",
-                n1->schema.count,
-                n2->schema.count);
+    if (n1->schema.count != n2->schema.count){
+       if(n1->schema.count > n2->schema.count)
+       for(i=0; i< n1->schema.count; i++){
+               if(n1->schema.items[i].name == col_score1){
+                       return set_operator (kind, n1, attach(n2, col_score1, 
lit_dbl(1)));
+               }
+       } else 
+               for(i=0; i< n2->schema.count; i++){
+                       if(n2->schema.items[i].name == col_score1){
+                       return set_operator (kind, attach(n1, col_score1, 
lit_dbl(1)), n2);
+                       }
+               }
+
+       if (n1->schema.count != n2->schema.count)
+       PFoops (OOPS_FATAL,
+                       "Schema of two arguments of set operation (%s) "
+                       "do not match. (%i #cols != %i #cols)",
+                       kind == la_disjunion
+                       ? "union"
+                       : kind == la_intersect
+                         ? "intersect"
+                         : "difference",
+                       n1->schema.count,
+                       n2->schema.count);
+
+    }
+
+
 
     /* allocate memory for the result schema */
     ret->schema.count = n1->schema.count;
@@ -4572,4 +4589,27 @@
     return n; /* satisfy picky compilers */
 }
 
+/** Check if score colomn exists if not then
+ *  add score coloumn
+ */
+PFla_op_t *
+attach_score (PFla_op_t *n){
+
+
+       unsigned int i;
+
+       for (i = 0; i < n->schema.count; i++) {
+               /* check if there's a coloumn named col_score1 */
+           if (n->schema.items[i].name == col_score1)
+               break;
+       }
+
+       if(i >= n->schema.count){
+               return attach(n, col_score1, lit_dbl(1));
+       } else {
+               return n;
+       }
+
+}
+
 /* vim:set shiftwidth=4 expandtab: */


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to