lucene-dev mailing list archives

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

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

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:
{code}
  if (schema.getField(field).isSingleValued()) {
    // a different thread asynchronously changes the field to a multi-valued field
    assert(schema.getField(field).isSingleValued())
    // do something only valid on a single-valued field
  }

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

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,
etc).
                
> dynamically add field to schema
> -------------------------------
>
>                 Key: SOLR-3251
>                 URL: https://issues.apache.org/jira/browse/SOLR-3251
>             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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message