rmuir commented on pull request #137:
URL: https://github.com/apache/lucene/pull/137#issuecomment-840111367


   it would be great to open a followup "wish" issue at least to think about 
ways we might remove the stored fields and term vectors threadlocals 
completely? The difficult part is figuring out how to make the api easy, but i 
feel like it should be possible, e.g. something minimally invasive like:
   
   ```java
   // old
   Document d1 = reader.doc(doc1);
   Document d2 = reader.doc(doc2);
   // new
   var storedfields = reader.getStoredFields();
   Document d1 = storedfields.doc(doc1);
   Document d2 = storedfields.doc(doc2);
   ``` 
   
   then the `storedfields` would just be garbage-collected normally like any 
other lucene index api. So you'd still prevent `clone()/shared 
dictionary/whatever` resources from happening per-document, but they'd happen 
per-query (is this good enough?)
   
   Anyway, just worth a thought for the future. I hate making these apis 
difficult to use, but at the same time I don't like how trappy the threadlocals 
can be (especially if you arent using fixed threadpools etc).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to