File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -114,10 +114,10 @@ void Hierarchy::finalize()
114114    }
115115
116116  std::cout << " Hierarchy: active items: "   << index - 1 
117-             << "  / cleared items: "   << m_items.size () - (index - 1 ) << std::flush ;
117+             << "  / cleared items: "   << m_items.size () - (index - 1 ) << " \n "  ;
118118}
119119
120- bool  Hierarchy::check_indexing ()
120+ bool  Hierarchy::check_indexing (bool  verbose )
121121{
122122  std::cout << " Check whether all items are indexed\n "  ;
123123
@@ -129,27 +129,35 @@ bool Hierarchy::check_indexing()
129129      if  (item->keep (false ) && !item->indexed ())
130130        {
131131          isok = false ;
132-           std::cout << " \n Item is not included into hierarchy while it should be\n "  ;
133-           item->print_item (0 );
132+           if  (verbose)
133+             {
134+               std::cout << " \n Item is not included into hierarchy while it should be\n "  ;
135+               item->print_item (0 );
134136
135-           std::cout << " \n Item part of hierarchy (child -> parent):\n "  ;
137+               std::cout << " \n Item part of hierarchy (child -> parent):\n "  ;
138+             }
136139
137140          auto              i = item;
138141          std::set<hindex> ids;
139142          for  (auto  parent = item->parent_id (); parent != 0 ; parent = i->parent_id ())
140143            {
141144              if  (m_items.find (parent) == m_items.end ())
142145                {
146+                   //  those are not expected to be many, keeping message
143147                  std::cout << " \n Cannot find parent with ID "   << parent << " \n "  ;
144148                  break ;
145149                }
146150
147151              i = m_items[parent];
148-               i->print_item (0 );
152+ 
153+               if  (verbose)
154+                 i->print_item (0 );
149155
150156              if  (ids.count (i->id ()) > 0 )
151157                {
152-                   std::cout << " \n Cyclic branch detected\n "  ;
158+                   if  (verbose)
159+                     std::cout << " \n Cyclic branch detected\n "  ;
160+ 
153161                  m_index_check_failed.insert (ids.begin (), ids.end ());
154162                  break ;
155163                }
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ class Hierarchy
2323  void  set_country (const  std::string &country, hindex id);
2424  void  cleanup ();
2525  void  finalize ();
26-   bool  check_indexing ();
26+   bool  check_indexing (bool  verbose =  false );
2727  void  write (sqlite3pp::database &db) const ;
2828
2929  size_t  get_missing_count () const  { return  m_root.size (); }
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments