Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Create an index
- solr create -c nested
- 2. Index two documents, where one is nested.
- curl localhost:8983/solr/a/update -d '<add>
- <doc>
- <field name="id">friend</field>
- <field name="type">other</field>
- </doc>
- <doc>
- <field name="id">mother</field>
- <field name="type">parent</field>
- <doc>
- <field name="id">daughter</field>
- <field name="type">child</field>
- </doc>
- </doc>
- </add>'
- 3. Search for children of "mother"
- curl "localhost:8983/solr/a/query?q=id:mother&fl=%2A%2C%5Bchild%20parentFilter%3Dtype%3Aparent%5Dā
- You get "friend" mistakenly in the list of children
- 4. Now index same two docs again, but in opposite order
- curl localhost:8983/solr/a/update -d '<add>
- <doc>
- <field name="id">mother</field>
- <field name="type">parent</field>
- <doc>
- <field name="id">daughter</field>
- <field name="type">child</field>
- </doc>
- </doc>
- <doc>
- <field name="id">friend</field>
- <field name="type">other</field>
- </doc>
- </add>'
- 5. Search again
- curl "localhost:8983/solr/a/query?q=id:mother&fl=%2A%2C%5Bchild%20parentFilter%3Dtype%3Aparent%5Dā
- You now only get "daughter" as child of "mother"
- Why?
Add Comment
Please, Sign In to add comment