You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Clemens Wyss DEV <cl...@mysign.ch> on 2015/05/15 10:01:48 UTC
schema.xml & xi:include -> copyField source :'_my_title' is not a
glob and doesn't match any explicit field or dynamicField
Given the following schema.xml
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="locale_de" version="1.5">
<uniqueKey>_my_id</uniqueKey>
<field indexed="true" name="_version_" stored="true" type="long"/>
<copyField dest="_my_suggest" source="_my_title"/>
<fields>
<field indexed="true" multiValued="false" name="_my_id" required="true" stored="true" type="string"/>
<field indexed="true" multiValued="false" name="_my_title" required="true" stored="true" type="string"/>
<field indexed="true" multiValued="true" name="_my_suggest" stored="false" type="string"/>
</fields>
<types>
<fieldType class="solr.StrField" name="string" sortMissingLast="true"/>
<fieldType class="solr.TrieLongField" name="long" positionIncrementGap="0" precisionStep="0"/>
</types>
</schema>
When I try to include the very schema from another schema file, e.g.:
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="locale_de" version="1.5">
<xi:include href="schema-common.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</schema>
I get SolrException
copyField source :'_my_title' is not a glob and doesn't match any explicit field or dynamicField
Am I facing a bug or a feature?
Thanks
- Clemens
AW: schema.xml & xi:include -> copyField source :'_my_title' is not a
glob and doesn't match any explicit field or dynamicField
Posted by Clemens Wyss DEV <cl...@mysign.ch>.
Perfect!
Thanks a lot
Clemens
-----Ursprüngliche Nachricht-----
Von: Steve Rowe [mailto:sarowe@gmail.com]
Gesendet: Freitag, 15. Mai 2015 23:13
An: solr-user@lucene.apache.org
Betreff: Re: schema.xml & xi:include -> copyField source :'_my_title' is not a glob and doesn't match any explicit field or dynamicField
Hi Clemens,
I forgot that XInclude requires well-formed XML, so schema-common.xml without <schema></schema> tags won’t work, since it will have multiple root elements.
But instead of XInclude, you can define external entities for files you want to include, and then include a reference to them where you want the contents to be included.
This worked for me:
——
schema.xml
——
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE schema [ <!ENTITY schema_common SYSTEM "schema-common.incl"> ]> <schema name="locale_de" version="1.5">
&schema_common;
</schema>
——
——
schema-common.incl
——
<uniqueKey>_my_id</uniqueKey>
<field indexed="true" name="_version_" stored="true" type="long"/> <copyField dest="_my_suggest" source="_my_title"/> <fields>
<field indexed="true" multiValued="false" name="_my_id" required="true" stored="true" type="string"/>
<field indexed="true" multiValued="false" name="_my_title" required="true" stored="true" type="string"/>
<field indexed="true" multiValued="true" name="_my_suggest" stored="false" type="string"/> </fields>
<types>
<fieldType class="solr.StrField" name="string" sortMissingLast="true"/>
<fieldType class="solr.TrieLongField" name="long" positionIncrementGap="0" precisionStep="0"/> </types> ——
Here’s what I get back from curl "http://localhost:8983/solr/mycore/schema?wt=schema.xml&indent=on”:
——
<?xml version="1.0" encoding="UTF-8"?>
<schema name="locale_de" version="1.5">
<uniqueKey>_my_id</uniqueKey>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
<field name="_my_id" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="_my_suggest" type="string" multiValued="true" indexed="true" stored="false"/>
<field name="_my_title" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="_version_" type="long" indexed="true" stored="true"/>
<copyField source="_my_title" dest="_my_suggest"/> </schema> ——
Steve
> On May 15, 2015, at 8:57 AM, Clemens Wyss DEV <cl...@mysign.ch> wrote:
>
> Thought about that too (should have written ;) ).
> When I remove the schema-tag from the composite xml I get:
> org.apache.solr.common.SolrException: Unable to create core [test]
> at org.apache.solr.core.CoreContainer.create(CoreContainer.java:533)
> at org.apache.solr.core.CoreContainer.create(CoreContainer.java:493)
> ...
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTest
> Runner.java:192) Caused by: org.apache.solr.common.SolrException:
> Could not load conf for core test: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').. Schema file is C:\source\search\search-impl\WebContent\WEB-INF\solr\configsets\test\conf\schema.xml
> at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:78)
> at org.apache.solr.core.CoreContainer.create(CoreContainer.java:516)
> ... 12 more
> Caused by: com.google.common.util.concurrent.UncheckedExecutionException: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').. Schema file is C:\source\search\search-impl\WebContent\WEB-INF\solr\configsets\test\conf\schema.xml
> at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199)
> at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
> at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4721)
> at org.apache.solr.core.ConfigSetService$SchemaCaching.createIndexSchema(ConfigSetService.java:206)
> at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:74)
> ... 13 more
> Caused by: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').. Schema file is C:\source\search\search-impl\WebContent\WEB-INF\solr\configsets\test\conf\schema.xml
> at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:596)
> at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:175)
> at org.apache.solr.schema.IndexSchemaFactory.create(IndexSchemaFactory.java:55)
> at org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:69)
> at org.apache.solr.core.ConfigSetService$SchemaCaching$1.call(ConfigSetService.java:210)
> at org.apache.solr.core.ConfigSetService$SchemaCaching$1.call(ConfigSetService.java:206)
> at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4724)
> at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
> at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
> at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
> at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
> ... 17 more
> Caused by: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').
> at org.apache.solr.core.Config.<init>(Config.java:156)
> at org.apache.solr.core.Config.<init>(Config.java:92)
> at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:455)
> ... 27 more
> Caused by: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').
> at org.apache.solr.core.Config.<init>(Config.java:145)
> ... 29 more
>
> -----Ursprüngliche Nachricht-----
> Von: Steve Rowe [mailto:sarowe@gmail.com]
> Gesendet: Freitag, 15. Mai 2015 13:30
> An: solr-user@lucene.apache.org
> Betreff: Re: schema.xml & xi:include -> copyField source :'_my_title'
> is not a glob and doesn't match any explicit field or dynamicField
>
> Hi Clemens,
>
> I think the problem is the structure of the composite schema - you’ll end up with:
>
> <schema> <- your other schema file
> <schema> <- the included schema-common.xml
> <copyField source=“_my_title” …
> <fields>
> <field name=“_my_title” …
>
> Field declarations are found in the schema using XPath expressions "/schema/fields/field” and "/schema/field”, which won’t be found, since in your composite schema they’re at “/schema/schema/fields/field”. You’re seeing the copyField error because copyField rules are found via XPath expression “//copyField”: they are found regardless of the containing structure.
>
> One way to address the issue you’re seeing is to remove the top-level <schema></schema> tags from your schema-common.xml. You won’t be able to use it alone in that case, but if you need to do that, you could just create another schema file that includes it inside wrapping <schema></schema> tags.
>
> Steve
>
>> On May 15, 2015, at 4:01 AM, Clemens Wyss DEV <cl...@mysign.ch> wrote:
>>
>> Given the following schema.xml
>> <?xml version="1.0" encoding="UTF-8" ?> <schema name="locale_de"
>> version="1.5"> <uniqueKey>_my_id</uniqueKey> <field indexed="true"
>> name="_version_" stored="true" type="long"/> <copyField
>> dest="_my_suggest" source="_my_title"/> <fields>
>> <field indexed="true" multiValued="false" name="_my_id" required="true" stored="true" type="string"/>
>> <field indexed="true" multiValued="false" name="_my_title" required="true" stored="true" type="string"/>
>> <field indexed="true" multiValued="true" name="_my_suggest"
>> stored="false" type="string"/> </fields> <types>
>> <fieldType class="solr.StrField" name="string" sortMissingLast="true"/>
>> <fieldType class="solr.TrieLongField" name="long"
>> positionIncrementGap="0" precisionStep="0"/> </types> </schema>
>>
>> When I try to include the very schema from another schema file, e.g.:
>> <?xml version="1.0" encoding="UTF-8" ?> <schema name="locale_de"
>> version="1.5"> <xi:include href="schema-common.xml"
>> xmlns:xi="http://www.w3.org/2001/XInclude"/>
>> </schema>
>>
>> I get SolrException
>> copyField source :'_my_title' is not a glob and doesn't match any
>> explicit field or dynamicField
>>
>> Am I facing a bug or a feature?
>>
>> Thanks
>> - Clemens
>
Re: schema.xml & xi:include -> copyField source :'_my_title' is not a glob and doesn't match any explicit field or dynamicField
Posted by Steve Rowe <sa...@gmail.com>.
Hi Clemens,
I forgot that XInclude requires well-formed XML, so schema-common.xml without <schema></schema> tags won’t work, since it will have multiple root elements.
But instead of XInclude, you can define external entities for files you want to include, and then include a reference to them where you want the contents to be included.
This worked for me:
——
schema.xml
——
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE schema [ <!ENTITY schema_common SYSTEM "schema-common.incl"> ]>
<schema name="locale_de" version="1.5">
&schema_common;
</schema>
——
——
schema-common.incl
——
<uniqueKey>_my_id</uniqueKey>
<field indexed="true" name="_version_" stored="true" type="long"/>
<copyField dest="_my_suggest" source="_my_title"/>
<fields>
<field indexed="true" multiValued="false" name="_my_id" required="true" stored="true" type="string"/>
<field indexed="true" multiValued="false" name="_my_title" required="true" stored="true" type="string"/>
<field indexed="true" multiValued="true" name="_my_suggest" stored="false" type="string"/>
</fields>
<types>
<fieldType class="solr.StrField" name="string" sortMissingLast="true"/>
<fieldType class="solr.TrieLongField" name="long" positionIncrementGap="0" precisionStep="0"/>
</types>
——
Here’s what I get back from curl "http://localhost:8983/solr/mycore/schema?wt=schema.xml&indent=on”:
——
<?xml version="1.0" encoding="UTF-8"?>
<schema name="locale_de" version="1.5">
<uniqueKey>_my_id</uniqueKey>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
<field name="_my_id" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="_my_suggest" type="string" multiValued="true" indexed="true" stored="false"/>
<field name="_my_title" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="_version_" type="long" indexed="true" stored="true"/>
<copyField source="_my_title" dest="_my_suggest"/>
</schema>
——
Steve
> On May 15, 2015, at 8:57 AM, Clemens Wyss DEV <cl...@mysign.ch> wrote:
>
> Thought about that too (should have written ;) ).
> When I remove the schema-tag from the composite xml I get:
> org.apache.solr.common.SolrException: Unable to create core [test]
> at org.apache.solr.core.CoreContainer.create(CoreContainer.java:533)
> at org.apache.solr.core.CoreContainer.create(CoreContainer.java:493)
> ...
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
> Caused by: org.apache.solr.common.SolrException: Could not load conf for core test: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').. Schema file is C:\source\search\search-impl\WebContent\WEB-INF\solr\configsets\test\conf\schema.xml
> at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:78)
> at org.apache.solr.core.CoreContainer.create(CoreContainer.java:516)
> ... 12 more
> Caused by: com.google.common.util.concurrent.UncheckedExecutionException: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').. Schema file is C:\source\search\search-impl\WebContent\WEB-INF\solr\configsets\test\conf\schema.xml
> at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199)
> at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
> at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4721)
> at org.apache.solr.core.ConfigSetService$SchemaCaching.createIndexSchema(ConfigSetService.java:206)
> at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:74)
> ... 13 more
> Caused by: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').. Schema file is C:\source\search\search-impl\WebContent\WEB-INF\solr\configsets\test\conf\schema.xml
> at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:596)
> at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:175)
> at org.apache.solr.schema.IndexSchemaFactory.create(IndexSchemaFactory.java:55)
> at org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:69)
> at org.apache.solr.core.ConfigSetService$SchemaCaching$1.call(ConfigSetService.java:210)
> at org.apache.solr.core.ConfigSetService$SchemaCaching$1.call(ConfigSetService.java:206)
> at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4724)
> at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
> at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
> at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
> at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
> ... 17 more
> Caused by: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').
> at org.apache.solr.core.Config.<init>(Config.java:156)
> at org.apache.solr.core.Config.<init>(Config.java:92)
> at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:455)
> ... 27 more
> Caused by: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').
> at org.apache.solr.core.Config.<init>(Config.java:145)
> ... 29 more
>
> -----Ursprüngliche Nachricht-----
> Von: Steve Rowe [mailto:sarowe@gmail.com]
> Gesendet: Freitag, 15. Mai 2015 13:30
> An: solr-user@lucene.apache.org
> Betreff: Re: schema.xml & xi:include -> copyField source :'_my_title' is not a glob and doesn't match any explicit field or dynamicField
>
> Hi Clemens,
>
> I think the problem is the structure of the composite schema - you’ll end up with:
>
> <schema> <- your other schema file
> <schema> <- the included schema-common.xml
> <copyField source=“_my_title” …
> <fields>
> <field name=“_my_title” …
>
> Field declarations are found in the schema using XPath expressions "/schema/fields/field” and "/schema/field”, which won’t be found, since in your composite schema they’re at “/schema/schema/fields/field”. You’re seeing the copyField error because copyField rules are found via XPath expression “//copyField”: they are found regardless of the containing structure.
>
> One way to address the issue you’re seeing is to remove the top-level <schema></schema> tags from your schema-common.xml. You won’t be able to use it alone in that case, but if you need to do that, you could just create another schema file that includes it inside wrapping <schema></schema> tags.
>
> Steve
>
>> On May 15, 2015, at 4:01 AM, Clemens Wyss DEV <cl...@mysign.ch> wrote:
>>
>> Given the following schema.xml
>> <?xml version="1.0" encoding="UTF-8" ?> <schema name="locale_de"
>> version="1.5"> <uniqueKey>_my_id</uniqueKey> <field indexed="true"
>> name="_version_" stored="true" type="long"/> <copyField
>> dest="_my_suggest" source="_my_title"/> <fields>
>> <field indexed="true" multiValued="false" name="_my_id" required="true" stored="true" type="string"/>
>> <field indexed="true" multiValued="false" name="_my_title" required="true" stored="true" type="string"/>
>> <field indexed="true" multiValued="true" name="_my_suggest"
>> stored="false" type="string"/> </fields>
>> <types>
>> <fieldType class="solr.StrField" name="string" sortMissingLast="true"/>
>> <fieldType class="solr.TrieLongField" name="long"
>> positionIncrementGap="0" precisionStep="0"/> </types> </schema>
>>
>> When I try to include the very schema from another schema file, e.g.:
>> <?xml version="1.0" encoding="UTF-8" ?> <schema name="locale_de"
>> version="1.5"> <xi:include href="schema-common.xml"
>> xmlns:xi="http://www.w3.org/2001/XInclude"/>
>> </schema>
>>
>> I get SolrException
>> copyField source :'_my_title' is not a glob and doesn't match any
>> explicit field or dynamicField
>>
>> Am I facing a bug or a feature?
>>
>> Thanks
>> - Clemens
>
AW: schema.xml & xi:include -> copyField source :'_my_title' is not a
glob and doesn't match any explicit field or dynamicField
Posted by Clemens Wyss DEV <cl...@mysign.ch>.
Thought about that too (should have written ;) ).
When I remove the schema-tag from the composite xml I get:
org.apache.solr.common.SolrException: Unable to create core [test]
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:533)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:493)
...
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.apache.solr.common.SolrException: Could not load conf for core test: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').. Schema file is C:\source\search\search-impl\WebContent\WEB-INF\solr\configsets\test\conf\schema.xml
at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:78)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:516)
... 12 more
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').. Schema file is C:\source\search\search-impl\WebContent\WEB-INF\solr\configsets\test\conf\schema.xml
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199)
at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4721)
at org.apache.solr.core.ConfigSetService$SchemaCaching.createIndexSchema(ConfigSetService.java:206)
at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:74)
... 13 more
Caused by: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').. Schema file is C:\source\search\search-impl\WebContent\WEB-INF\solr\configsets\test\conf\schema.xml
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:596)
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:175)
at org.apache.solr.schema.IndexSchemaFactory.create(IndexSchemaFactory.java:55)
at org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:69)
at org.apache.solr.core.ConfigSetService$SchemaCaching$1.call(ConfigSetService.java:210)
at org.apache.solr.core.ConfigSetService$SchemaCaching$1.call(ConfigSetService.java:206)
at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4724)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
... 17 more
Caused by: org.apache.solr.common.SolrException: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').
at org.apache.solr.core.Config.<init>(Config.java:156)
at org.apache.solr.core.Config.<init>(Config.java:92)
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:455)
... 27 more
Caused by: org.xml.sax.SAXParseException; systemId: solrres:/schema.xml; lineNumber: 3; columnNumber: 84; Error attempting to parse XML file (href='schema-common.xml').
at org.apache.solr.core.Config.<init>(Config.java:145)
... 29 more
-----Ursprüngliche Nachricht-----
Von: Steve Rowe [mailto:sarowe@gmail.com]
Gesendet: Freitag, 15. Mai 2015 13:30
An: solr-user@lucene.apache.org
Betreff: Re: schema.xml & xi:include -> copyField source :'_my_title' is not a glob and doesn't match any explicit field or dynamicField
Hi Clemens,
I think the problem is the structure of the composite schema - you’ll end up with:
<schema> <- your other schema file
<schema> <- the included schema-common.xml
<copyField source=“_my_title” …
<fields>
<field name=“_my_title” …
Field declarations are found in the schema using XPath expressions "/schema/fields/field” and "/schema/field”, which won’t be found, since in your composite schema they’re at “/schema/schema/fields/field”. You’re seeing the copyField error because copyField rules are found via XPath expression “//copyField”: they are found regardless of the containing structure.
One way to address the issue you’re seeing is to remove the top-level <schema></schema> tags from your schema-common.xml. You won’t be able to use it alone in that case, but if you need to do that, you could just create another schema file that includes it inside wrapping <schema></schema> tags.
Steve
> On May 15, 2015, at 4:01 AM, Clemens Wyss DEV <cl...@mysign.ch> wrote:
>
> Given the following schema.xml
> <?xml version="1.0" encoding="UTF-8" ?> <schema name="locale_de"
> version="1.5"> <uniqueKey>_my_id</uniqueKey> <field indexed="true"
> name="_version_" stored="true" type="long"/> <copyField
> dest="_my_suggest" source="_my_title"/> <fields>
> <field indexed="true" multiValued="false" name="_my_id" required="true" stored="true" type="string"/>
> <field indexed="true" multiValued="false" name="_my_title" required="true" stored="true" type="string"/>
> <field indexed="true" multiValued="true" name="_my_suggest"
> stored="false" type="string"/> </fields>
> <types>
> <fieldType class="solr.StrField" name="string" sortMissingLast="true"/>
> <fieldType class="solr.TrieLongField" name="long"
> positionIncrementGap="0" precisionStep="0"/> </types> </schema>
>
> When I try to include the very schema from another schema file, e.g.:
> <?xml version="1.0" encoding="UTF-8" ?> <schema name="locale_de"
> version="1.5"> <xi:include href="schema-common.xml"
> xmlns:xi="http://www.w3.org/2001/XInclude"/>
> </schema>
>
> I get SolrException
> copyField source :'_my_title' is not a glob and doesn't match any
> explicit field or dynamicField
>
> Am I facing a bug or a feature?
>
> Thanks
> - Clemens
Re: schema.xml & xi:include -> copyField source :'_my_title' is not a glob and doesn't match any explicit field or dynamicField
Posted by Steve Rowe <sa...@gmail.com>.
Hi Clemens,
I think the problem is the structure of the composite schema - you’ll end up with:
<schema> <- your other schema file
<schema> <- the included schema-common.xml
<copyField source=“_my_title” …
<fields>
<field name=“_my_title” …
Field declarations are found in the schema using XPath expressions "/schema/fields/field” and "/schema/field”, which won’t be found, since in your composite schema they’re at “/schema/schema/fields/field”. You’re seeing the copyField error because copyField rules are found via XPath expression “//copyField”: they are found regardless of the containing structure.
One way to address the issue you’re seeing is to remove the top-level <schema></schema> tags from your schema-common.xml. You won’t be able to use it alone in that case, but if you need to do that, you could just create another schema file that includes it inside wrapping <schema></schema> tags.
Steve
> On May 15, 2015, at 4:01 AM, Clemens Wyss DEV <cl...@mysign.ch> wrote:
>
> Given the following schema.xml
> <?xml version="1.0" encoding="UTF-8" ?>
> <schema name="locale_de" version="1.5">
> <uniqueKey>_my_id</uniqueKey>
> <field indexed="true" name="_version_" stored="true" type="long"/>
> <copyField dest="_my_suggest" source="_my_title"/>
> <fields>
> <field indexed="true" multiValued="false" name="_my_id" required="true" stored="true" type="string"/>
> <field indexed="true" multiValued="false" name="_my_title" required="true" stored="true" type="string"/>
> <field indexed="true" multiValued="true" name="_my_suggest" stored="false" type="string"/>
> </fields>
> <types>
> <fieldType class="solr.StrField" name="string" sortMissingLast="true"/>
> <fieldType class="solr.TrieLongField" name="long" positionIncrementGap="0" precisionStep="0"/>
> </types>
> </schema>
>
> When I try to include the very schema from another schema file, e.g.:
> <?xml version="1.0" encoding="UTF-8" ?>
> <schema name="locale_de" version="1.5">
> <xi:include href="schema-common.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
> </schema>
>
> I get SolrException
> copyField source :'_my_title' is not a glob and doesn't match any explicit field or dynamicField
>
> Am I facing a bug or a feature?
>
> Thanks
> - Clemens