@@ -607,6 +607,7 @@ impl PyTextSelection {
607607 where
608608 F : FnOnce ( ResultTextSelection , Query ) -> Result < T , StamError > ,
609609 {
610+ let debug = get_debug ( kwargs) ;
610611 self . map ( |textselection| {
611612 let query = build_query (
612613 Query :: new ( QueryType :: Select , Some ( resulttype) , Some ( "result" ) )
@@ -617,6 +618,9 @@ impl PyTextSelection {
617618 )
618619 . map_err ( |e| StamError :: QuerySyntaxError ( format ! ( "{}" , e) , "(python to query)" ) ) ?
619620 . with_textvar ( "main" , & textselection) ;
621+ if debug {
622+ eprintln ! ( "[STAM DEBUG]: {}" , query. to_string( ) ?) ;
623+ }
620624 f ( textselection, query)
621625 } )
622626 }
@@ -952,6 +956,7 @@ impl PyTextSelections {
952956 where
953957 F : FnOnce ( Query , & AnnotationStore ) -> Result < T , StamError > ,
954958 {
959+ let debug = get_debug ( kwargs) ;
955960 self . map ( |textselections, store| {
956961 let query = Query :: new ( QueryType :: Select , Some ( Type :: Annotation ) , Some ( "main" ) )
957962 . with_constraint ( Constraint :: TextSelections (
@@ -970,6 +975,9 @@ impl PyTextSelections {
970975 StamError :: QuerySyntaxError ( format ! ( "{}" , e) , "(python to query)" )
971976 } ) ?,
972977 ) ;
978+ if debug {
979+ eprintln ! ( "[STAM DEBUG]: {}" , query. to_string( ) ?) ;
980+ }
973981 f ( query, store)
974982 } )
975983 }
0 commit comments