[ 
https://issues.apache.org/jira/browse/LUCENE-7659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15838861#comment-15838861
 ] 

Adrien Grand commented on LUCENE-7659:
--------------------------------------

I think this change is not thread-safe? It currently returns a view 
({{Map.keySet()}}) of the field numbers map which may be written to at any time 
by {{IndexWriter}}, I think it should rather take a snapshot under the lock? 
Ie. something like this:
{code}
+    synchronized Set<String> getFieldNames() {
+      return Collections.unmodifiableSet(new HashSet<>(nameToNumber.keySet()));
+    }
{code}

> IndexWriter should expose field names
> -------------------------------------
>
>                 Key: LUCENE-7659
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7659
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Ishan Chattopadhyaya
>            Assignee: Ishan Chattopadhyaya
>         Attachments: LUCENE-7659.patch, LUCENE-7659.patch, LUCENE-7659.patch
>
>
> While working on SOLR-5944, I needed a way to know whether applying an update 
> to a DV is possible (i.e. the DV exists or not), while deciding upon whether 
> or not to apply the update as an in-place update or a regular full document 
> update. This information is present at the IndexWriter in a FieldInfos 
> instance, and can be exposed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to