lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley (JIRA)" <>
Subject [jira] [Commented] (SOLR-3251) dynamically add field to schema
Date Fri, 05 Apr 2013 15:27:17 GMT


Yonik Seeley commented on SOLR-3251:

There are two different (but related) issues here:
1. Should the schema object be immutable?
2. When (or how often) are schema changes visible?

A mutable schema answers both questions at once... all changes are seen immediately.
An immutable schema moves you on to question #2

Here's a hypothetical issue with a mutable schema:
  if (schema.getField(field).isSingleValued()) {
    // a different thread asynchronously changes the field to a multi-valued field
    // do something only valid on a single-valued field

  if (schema.getField(field) != null) {
    // a different thread asynchronously remove the field from the schema

Those types of issues are hard to enumerate and would be ongoing.
Those issues could pretty much be eliminated for the query side by binding a schema to a request
(just as a request gets the same SolrIndexSearcher for it's duration), or binding it to the
SolrIndexSearcher itself (may be more "cache" friendly if any schema changes could change
search results).  That would be very simple to do ... SolrCore.schema would be volatile and
point to the latest immutable schema object, and the request object would simply copy the
reference in it's constructor. 

On the indexing side, changes need to be visible more quickly to handle the case of adding
a new field and then indexing a document with that new field.  The reference to the schema
in the SchemaCodecFactory would need to be updated (if we went with immutable schema objects),
or the SchemaCodecFactory would need a reference to the SolrCore so it could always use the
latest SolrCore.schema to do lookups.

So I think I'm saying that a schema should be effectively immutable for request scope and
maybe SolrIndexSearcher scope, but pretty much "live" for indexing purposes, while I think
Robert is saying that the schema should be immutable for the scope of a single IndexWriter.
 The latter would be a big impediment to where we're going with this (schema-less, type-guessing,
> dynamically add field to schema
> -------------------------------
>                 Key: SOLR-3251
>                 URL:
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Yonik Seeley
>            Assignee: Steve Rowe
>         Attachments: SOLR-3251.patch, SOLR-3251.patch, SOLR-3251.patch
> One related piece of functionality needed for SOLR-3250 is the ability to dynamically
add a field to the schema.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message