STORED field with glob deleted after commit with optimize

Issue #472 new
Former user created an issue

Code to reproduce:

import tempfile                                                                                     

from whoosh import fields                                                                           
from whoosh import index                                                                            

# Schema with glob stored                                                                           
schema = fields.Schema()                                                                            
schema.add("f*", fields.STORED, glob=True)                                                          

# Init index                                                                                        
tmp = tempfile.mkdtemp()                                                                            
ix = index.create_in(tmp, schema)                                                                   

# Initial doc                                                                                       
writer = ix.writer()                                                                                
writer.add_document(f1=1, f2=2)                                                                     
writer.commit()                                                                                     
ix.close()                                                                                          

# Read back fields                                                                                  
ix = index.open_dir(tmp)                                                                            
print(list(ix.reader().all_stored_fields()))                                                        
# [{'f1': 1, 'f2': 2}]                                                                              
ix.close()                                                                                          

# Use writer to commit with optimize                                                                
ix = index.open_dir(tmp)                                                                            
writer = ix.writer()                                                                                
writer.commit(optimize=True)                                                                        
ix.close()                                                                                          

# Read fields again                                                                                 
ix = index.open_dir(tmp)                                                                            
print(list(ix.reader().all_stored_fields()))                                                        
# [{}]                                                                                              
ix.close()                                                                                          

Comments (1)

  1. Log in to comment