If you do not use API or Admin to change schema, it will not get
automatically rewritten. So you can just stay with managed-shema file and
version that. You can even disable write changes in solrconfig.xml:
http://lucene.apache.org/solr/guide/7_6/schema-factory-definition-in-solrconfig.html#solr-uses-managed-schema-by-default


Also, the file format of managed-schema is XML even if it does not have the
appropriate extension.

Finally, since you are trying to really tweak the schema and general
configuration right from the start, you may find some of my presentations
useful, as they show the minimal configuration. Not perfect for your needs,
as I do skip _version, but as an additional data point. The recent one is:
https://www.slideshare.net/arafalov/rapid-solr-schema-development-phone-directory
and the Git repo is at:
https://github.com/arafalov/solr-presentation-2018-may . This one may be
useful as well:
https://www.slideshare.net/arafalov/from-content-to-search-speeddating-apache-solr-apachecon-2018-116330553

Regards,
   Alex.

On Wed, Jan 23, 2019, 5:50 AM Aleksandar Dimitrov <
a.dimit...@seidemann-web.com wrote:

> Hi Alex,
>
> thanks for you answer. I took the lines directly from the
> managed-schema, deleted the managed-schema, and pasted those lines
> into
> my schema.xml.
>
> If I have other errors in the schema.xml (such as a missing field
> type),
> solr complains about those until I fix them. So I would guess that
> the
> schema is at least *read*, but unsure if it is in fact used. I've
> not
> used solr before.
>
> I cannot use the admin UI, at least not while the core with the
> faulty
> schema is used.
>
> I wanted to use schema.xml because it allows for version control,
> and
> because it's easier for me to just use xml to define my schema. Is
> there
> a preferred approach? I don't (want to) use solr cloud, as for our
> use
> case a single instance of solr is more than enough.
>
> Thanks for your help,
> Aleks
>
> Alexandre Rafalovitch <arafa...@gmail.com> writes:
>
> > What do you mean schema.xml from managed-schema? schema.xml is
> > old
> > non-managed approach. If you have both, schema.xml will be
> > ignored.
> >
> > I suspect you are not running with the schema you think you do.
> > You can
> > check that with API or in Admin UI if you get that far.
> >
> > Regards,
> >     Alex
> >
> > On Tue, Jan 22, 2019, 11:39 AM Aleksandar Dimitrov <
> > a.dimit...@seidemann-web.com wrote:
> >
> >> Hi,
> >>
> >> I'm using solr 7.5, in my schema.xml I have this, which I took
> >> from the
> >> managed-schema:
> >>
> >>   <!-- Solr private fields -->
> >>   <!-- docValues are enabled by default for long type so we
> >>   don't
> >>   need to index the version field  -->
> >>   <field name="_version_" type="plong" indexed="false"
> >>   stored="false" />
> >>   <fieldType name="plong" class="solr.LongPointField"
> >>   docValues="true" />
> >>
> >> However, on startup, solr complains:
> >>
> >>  Caused by: org.apache.solr.common.SolrException: _version_
> >>  field
> >>  must exist in schema and be searchable (indexed or docValues)
> >>  and
> >>  retrievable(stored or docValues) and not multiValued
> >>  (_version_
> >>  does not exist)
> >>       at
> >>
> >>
> org.apache.solr.update.VersionInfo.getAndCheckVersionField(VersionInfo.java:69)
> >>
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       at
> >>       org.apache.solr.update.VersionInfo.<init>(VersionInfo.java:95)
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       at
> >>       org.apache.solr.update.UpdateLog.init(UpdateLog.java:404)
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       at
> >>
>  org.apache.solr.update.UpdateHandler.<init>(UpdateHandler.java:161)
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       at
> >>
>  org.apache.solr.update.UpdateHandler.<init>(UpdateHandler.java:116)
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       at
> >>
> >>
> org.apache.solr.update.DirectUpdateHandler2.<init>(DirectUpdateHandler2.java:119)
> >>
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       at
> >>
> >> jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> >>       Method) ~[?:?]
> >>       at
> >>
> >>
> jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> >>
> >>       ~[?:?]
> >>       at
> >>
> >>
> jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> >>
> >>       ~[?:?]
> >>       at
> >>       java.lang.reflect.Constructor.newInstance(Constructor.java:488)
> >>       ~[?:?]
> >>       at
> >>       org.apache.solr.core.SolrCore.createInstance(SolrCore.java:799)
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       at
> >>
>  org.apache.solr.core.SolrCore.createUpdateHandler(SolrCore.java:861)
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       at
> >>
>  org.apache.solr.core.SolrCore.initUpdateHandler(SolrCore.java:1114)
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       at
> >>       org.apache.solr.core.SolrCore.<init>(SolrCore.java:984)
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       at
> >>       org.apache.solr.core.SolrCore.<init>(SolrCore.java:869)
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       at
> >>
> >>
> org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1138)
> >>
> >>       ~[solr-core-7.5.0.jar:7.5.0
> >>       b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi -
> >>       2018-09-18 13:07:55]
> >>       ... 7 more
> >>
> >> Anyone know what I'm doing wrong?
> >> I've tried having the _version_ field be string, and indexed
> >> and
> >> stored,
> >> but that didn't help.
> >>
> >> Thanks!
> >>
> >> Aleks
> >>
> >>
>
>
>

Reply via email to