Update of /cvsroot/monetdb/pathfinder/modules/pftijah
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv17440/modules/pftijah

Modified Files:
      Tag: M5XQ
        pftijah.mx 
Log Message:
propagated changes of Wednesday Oct 21 2009 - Thursday Oct 22 2009
from the development trunk to the M5XQ branch

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/10/21 - jflokstra: modules/pftijah/pftijah.mx,1.243
  - 2 more fixes to make ftcontains work
    1) fix self inflicted pathfinder variable name problem
    2) fix usage of ftindex (:= ftiName + "0")
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/10/22 - jflokstra: modules/pftijah/pftijah.mx,1.244
  - fix problem with pf:add-doc() on non tijah database.
  
  - mark infinitely waiting ws_create(0) call with tj_tracers.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: pftijah.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/pftijah.mx,v
retrieving revision 1.226.2.15
retrieving revision 1.226.2.16
diff -u -d -r1.226.2.15 -r1.226.2.16
--- pftijah.mx  21 Oct 2009 10:38:03 -0000      1.226.2.15
+++ pftijah.mx  22 Oct 2009 11:00:22 -0000      1.226.2.16
@@ -759,7 +759,7 @@
         subcommit(extra_del_bat);
     }
     #subcommit(_tj_collection_str(ftiName));
-   lock_unset(coll_lock);
+    lock_unset(coll_lock);
     #
     if (not(isnil(err))) ERROR(err);
     #
@@ -1732,8 +1732,10 @@
        }
     }
     var        i_start := usec();
+    # tj_trace("/tmp/ws_create0_err",HASH +" _tj_add2collection_frag: calling 
ws_create");
 
-    var ws_opt := ws_create(0);
+    var ws_opt := ws_create(0); # ERROR: INFINITE IDLE WAIT!!!
+    # tj_trace("/tmp/ws_create0_err",HASH +" _tj_add2collection_frag: 
returning from ws_create");
     ws_opendoc(ws_opt, bat(void,str,1).append(uri_name));
     _tj_throw2collection(collBat,ws_opt,uri_name);
     ws_destroy(ws_opt);
@@ -2712,6 +2714,9 @@
      return res;
 }
 
+#
+var ftindex;
+
 # temporary algebra query handler
 PROC ALG_tj_ftfun_handler(
         bit par_storeScore,
@@ -2740,6 +2745,7 @@
      # compiler we generate an unused ftiName var in the generated pathfinder
      # mil script and assign it with this assigment.
      ftiName := dflt_ft_index;
+     ftindex := ftiName + "0";
 
      result_item_s := new(oid,dbl);
 
@@ -2794,6 +2800,7 @@
          var tjPre_score := 
tj_containing_query_nest_pre_term_NLLR(iter_tjPre.reverse(), Q);
          var iter_score := iter_tjPre.leftjoin(tjPre_score);
 
+
          result_item_s.append(iter_score);
         });
         lock_unset(tijah_lock);
@@ -2802,6 +2809,11 @@
      var result_item_b;
      result_iter   := pfop_sn.fetch(0...@0);
      result_item_b := [>](result_item_s,dbl(0.0));
+     if ( verbose ) {
+       result_iter.print();
+       result_item_b.print();
+       result_item_s.print();
+     }
      result_ipik   := result_item_b;
      result_kind   := pfop_sn.fetch(2...@0).set_kind(BOOL);
      var result_pos:= pfop_sn.fetch(3...@0);
@@ -2822,7 +2834,7 @@
        BAT[str,bat]  tape
        ) : BAT[str,bat] 
 {
-        if ( verbose ) printf(HASH +" ALG_tj_add_fti_tape: START.\n");
+        if ( verbose ) printf(HASH +" ALG_tj_add_fti_tape: START xxx.\n");
         var has_coll := (pfop_coll.count_wrd() > wrd(0));
         var has_opt  := (pfop_opt.count_wrd() > wrd(0));
         par_l...@batloop() {
@@ -2900,6 +2912,7 @@
        # INCOMPLETE, CHECK IF THIS REALLY STILL WORKS
        #
         if (isnil(CATCH(bat("tj_collName").count_wrd()))) {
+            if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: pftijah is 
active.\n");
            # pftijah is active
             if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: running 
document management.\n");
             var del_doc    := percentages.ord_uselect(-1LL).hmark(0...@0); 
@@ -2934,31 +2947,32 @@
                 if ( verbose ) { printf(HASH +"TJ:tj_play_doc_tape() doing 
ft-index \"%s\".\n",$h); $t.print(); }
                 tj_add2collection($h,$t,false);
             }
+
+            if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: running 
collection management.\n");
+            t...@batloop() {
+               var op       := $h;
+               var collbat  := $t.fetch(0...@0);
+               var optbat   := $t.fetch(1...@0);
+               var fti_name := tj_get_ft_index(optbat,(op!="create"));
+
+               if ( op = "create" ) {
+                    if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: 
tj_init_collection(%s).\n",fti_name);
+                   tj_init_collection(fti_name,optbat,collbat);
+               } else if ( op = "extend" ) {
+                    if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: 
tj_extend_collection(%s).\n",fti_name);
+                   tj_extend_collection(fti_name,collbat);
+               } else if ( op = "remove" ) {
+                    if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: 
tj_delete_collection(%s).\n",fti_name);
+                   tj_delete_collection(fti_name);
+               } else {
+                   ERROR("ALG_tj_docmgmt_tape: unknown op");
+               }
+           }
        } else {
            # pftijah is not active
            if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: skipping doc 
managemnt.\n");
        }
 
-        if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: running collection 
management.\n");
-        t...@batloop() {
-           var op       := $h;
-           var collbat  := $t.fetch(0...@0);
-           var optbat   := $t.fetch(1...@0);
-           var fti_name := tj_get_ft_index(optbat,(op!="create"));
-
-           if ( op = "create" ) {
-                if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: 
tj_init_collection(%s).\n",fti_name);
-               tj_init_collection(fti_name,optbat,collbat);
-           } else if ( op = "extend" ) {
-                if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: 
tj_extend_collection(%s).\n",fti_name);
-               tj_extend_collection(fti_name,collbat);
-           } else if ( op = "remove" ) {
-                if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: 
tj_delete_collection(%s).\n",fti_name);
-               tj_delete_collection(fti_name);
-           } else {
-               ERROR("ALG_tj_docmgmt_tape: unknown op");
-           }
-       }
         if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: FINISH.\n");
        return true;
 }
@@ -2988,15 +3002,15 @@
               doclist := new(str,str);
               fti_cluster.insert(ftiName, doclist);
             }
-
-           if ( op = "create" ) {
+   
+           if ( op = "create" ) {
                 if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: 
init_collection(%s).\n",ftiName);
-               tj_init_collection_base(ftiName, optbat);
-                modify_pfc_fti(ftiName, collbat);
-                if ( collbat.uselect("*").count_wrd() > wrd(0) ) {
-                   var tmp := bat("doc_name");
-                   doclist.insert(tmp.reverse().project(str(nil)).reverse());
-                } else {
+            tj_init_collection_base(ftiName, optbat);
+            modify_pfc_fti(ftiName, collbat);
+            if ( collbat.uselect("*").count_wrd() > wrd(0) ) {
+               var tmp := bat("doc_name");
+               doclist.insert(tmp.reverse().project(str(nil)).reverse());
+            } else {
                    var tmp := 
bat("doc_name").semijoin(bat("doc_collection").join(bat("collection_name").join(collbat.reverse())));
                    doclist.insert(tmp.reverse().project(str(nil)).reverse());
                 }
@@ -3014,48 +3028,56 @@
                 if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: 
tj_delete_collection(%s).\n",ftiName);
                tj_collection_delete(ftiName);
            } else {
-               ERROR("ALG_tj_docmgmt_tape: unknown op");
+               ERROR("ALG_tj_docmgmt_tape: unknown op");
            }
        }
+    
 
         # commit dependency bats, since they might be changed
         var submit_bats := new(void,str).seqbase(0...@0);
         submit_bats.append("tj_pfc_fti_dep");
         submit_bats.append("tj_pfc_fti_dep_star");
         subcommit(submit_bats);
+    
 
-       # determine which documents added to pathfinder have to get indexed by 
pf/tijah due to dependencies
-        # add those documents to the doclist for each ft-index (fti_cluster) 
-        var pfc_name   := docnames.reverse().leftfetchjoin(colnames);
-        var pfdep      := bat("tj_pfc_fti_dep");
-        var pfdep_star := bat("tj_pfc_fti_dep_star");
-        
-        var fti_dname  := pfdep.join(pfc_name.reverse());
-        if ( pfdep_star.count_wrd() > wrd(0) ) {
-            fti_dname.insert(pfdep_star.cross(pfc_name.reverse()));
-        }
-
-        fti_dn...@batloop() {
-            var cb;
-            if ( fti_cluster.exist($h) ) {
-              cb := fti_cluster.find($h);
-            } else {
-              cb := new(str,str);
-              fti_cluster.insert($h,cb);
+        if (isnil(CATCH(bat("tj_collName").count_wrd()))) {
+            if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: pftijah is 
active.\n");
+           # determine which documents added to pathfinder have to get indexed 
by pf/tijah due to dependencies
+            # add those documents to the doclist for each ft-index 
(fti_cluster) 
+            var pfc_name   := docnames.reverse().leftfetchjoin(colnames);
+            var pfdep      := bat("tj_pfc_fti_dep");
+            var pfdep_star := bat("tj_pfc_fti_dep_star");
+            
+            var fti_dname  := pfdep.join(pfc_name.reverse());
+            if ( pfdep_star.count_wrd() > wrd(0) ) {
+                fti_dname.insert(pfdep_star.cross(pfc_name.reverse()));
             }
-            cb.insert(str(nil),$t);
-        }
-        fti_clus...@batloop() {
-            if ( verbose ) { printf(HASH +"TJ:tj_play_doc_tape() doing 
ft-index \"%s\".\n",$h); $t.print(); }
-            tj_add2collection_frag($h,$t,false);
-        }
-
+    
+            fti_dn...@batloop() {
+                var cb;
+                if ( fti_cluster.exist($h) ) {
+                  cb := fti_cluster.find($h);
+                } else {
+                  cb := new(str,str);
+                  fti_cluster.insert($h,cb);
+                }
+                cb.insert(str(nil),$t);
+            }
+            fti_clus...@batloop() {
+                if ( verbose ) { printf(HASH +"TJ:tj_play_doc_tape() doing 
ft-index \"%s\".\n",$h); $t.print(); }
+                tj_add2collection_frag($h,$t,false);
+            }
+    
+       } else {
+            if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: pftijah not 
active.\n");
+       }
         if ( verbose ) printf(HASH +" ALG_tj_docmgmt_tape: FINISH.\n");
        return true;
 }
 
 var tracefile_handle := nil;
-PROC tj_trace( str s ) : void  
+
+PROC tj_trace(str tracefile, str s) : void  
 {
     if ( not( tracefile = "" ) ) {
         if ( isnil( tracefile_handle ) )


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to