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

Modified Files:
      Tag: M5XQ
        core.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/core/core.c,1.69
  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: core.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/core/core.c,v
retrieving revision 1.67.4.1
retrieving revision 1.67.4.2
diff -u -d -r1.67.4.1 -r1.67.4.2
--- core.c      7 May 2009 14:45:28 -0000       1.67.4.1
+++ core.c      9 Nov 2009 00:03:27 -0000       1.67.4.2
@@ -614,6 +614,7 @@
  * @param bindvar  variable bound in the for clause
  * @param pos      positional variable
  */
+
 PFcnode_t *
 PFcore_forvars (const PFcnode_t *bindvar, const PFcnode_t *pos)
 {
@@ -624,6 +625,23 @@
 }
 
 /**
+ * Variables bound in a for clause with score variable
+ *
+ * @param bindvar  variable bound in the for clause
+ * @param pos      positional variable
+ * @param score    full-text score variable
+ */
+PFcnode_t *
+PFcore_forvars2 (const PFcnode_t *bindvar, const PFcnode_t *pos, const 
PFcnode_t *score)
+{
+    assert (bindvar); assert (bindvar->kind == c_var);
+    assert (pos); assert (pos->kind == c_var || pos->kind == c_nil);
+    assert (score); assert (score->kind == c_var || score->kind == c_nil);
+
+    return PFcore_wire2 (c_forvars, bindvar, PFcore_wire2(c_vars, pos, score));
+}
+
+/**
  * Create a core tree node representing a let binding:
  *
  *    let v := e1 return e2
@@ -1669,20 +1687,26 @@
 PFcnode_t *
 PFcore_some (const PFcnode_t *v, const PFcnode_t *expr, const PFcnode_t *qExpr)
 {
-    PFfun_t *fn_exists = PFcore_function (PFqname (PFns_fn, "exists"));
 
-    return APPLY (fn_exists,
-                  PFcore_flwr (
-                      PFcore_for (
-                          PFcore_forbind (
-                              PFcore_forvars (
-                                  v,
-                                  PFcore_nil ()),
-                              expr),
-                          PFcore_nil ()),
-                      PFcore_where (
-                          PFcore_ebv (qExpr),
-                          PFcore_num (1))));
+    PFfun_t *fn_not   = PFcore_function (PFqname (PFns_fn, "not"));
+    PFfun_t *fn_empty = PFcore_function (PFqname (PFns_fn, "empty"));
+
+    return APPLY (fn_not,
+                  APPLY (fn_empty,
+                         PFcore_flwr (
+                             PFcore_for (
+                                 PFcore_forbind (
+                                     PFcore_forvars (
+                                         v,
+                                         PFcore_nil ()),
+                                     expr),
+                                 PFcore_nil ()),
+                                 PFcore_if
+                                    (PFcore_ebv (qExpr),
+                                     PFcore_then_else (
+                                         PFcore_num (1),
+                                         PFcore_empty ())))));
+
 }
 
 /**


------------------------------------------------------------------------------
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