简体   繁体   中英

how to define hierarchy fields in solr's schema.xml?

I gooeled and search for the title, there was a lot of results returned on how to create QUERY for hierarchy/nested fields but no clear answer as to how it would be defined in schema.xml.

Let me be very specific, say I have json records of following format (very simplified version) :

Office string
city string
zipcode string
Home
city string
zipcode string
City string

If I just want to index/store home.city then how would I define that in the "field" in schema.xml?

The schema has to be the union of all the fields as one collection has only one real definition which includes everything.

So: city , zipcode , and probably type to differentiate. Plus whatever Solr requires for parent/child relationship management ( id , _root_ , _version_ ).

If the fields are different, then you need to make sure that the fields that only happen in one type and not another are optional.

That's assuming you are indexing child-records as separate documents. If you want to merge them all in one parent document, then you need to do some folding of the content on the client. ElasticSearch gives you a slightly better interface for that, though - under the covers - the issues of a single real definition are still the same (they come from Lucene, which both use).

Solr does not support nested field. If you are looking for a search engine with the above feature you can try out elastic search . Elastic search also have lucence at its core and it offers lot more than what solr has to offer as far as scalaibility, full text search features, auto sharding, easy import export of data is concerned.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM