Commits

Jason R. Coombs committed ba4d416

Proxy the schema in the reader and writer

  • Participants
  • Parent commits 2f59335

Comments (0)

Files changed (3)

 		return not self.doc_count()
 
 	def reader(self, reuse=None):
+		if reuse:
+			reuse.index = self
 		return reuse or reading.IndexReader(self)
 
 	def writer(self, **kwargs):

thwump/reading.py

 	def __init__(self, index):
 		self.index = index
 
+	@property
+	def schema(self):
+		return self.index.schema
+
 	def __contains__(self, term):
 		"""
 		Returns True if the given term tuple (fieldname, text) is

thwump/writing.py

 	def __init__(self, index):
 		self.index = index
 
+	@property
+	def schema(self):
+		return self.index.schema
+
 	def add_document(self, **fields):
 		self.index.collection.insert(fields)