Guest User

Untitled

a guest
Jan 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. 1. Create an index
  2.  
  3. solr create -c nested
  4.  
  5. 2. Index two documents, where one is nested.
  6.  
  7. curl localhost:8983/solr/a/update -d '<add>
  8. <doc>
  9. <field name="id">friend</field>
  10. <field name="type">other</field>
  11. </doc>
  12. <doc>
  13. <field name="id">mother</field>
  14. <field name="type">parent</field>
  15. <doc>
  16. <field name="id">daughter</field>
  17. <field name="type">child</field>
  18. </doc>
  19. </doc>
  20. </add>'
  21.  
  22. 3. Search for children of "mother"
  23.  
  24. curl "localhost:8983/solr/a/query?q=id:mother&fl=%2A%2C%5Bchild%20parentFilter%3Dtype%3Aparent%5Dā€
  25. You get "friend" mistakenly in the list of children
  26.  
  27. 4. Now index same two docs again, but in opposite order
  28.  
  29. curl localhost:8983/solr/a/update -d '<add>
  30. <doc>
  31. <field name="id">mother</field>
  32. <field name="type">parent</field>
  33. <doc>
  34. <field name="id">daughter</field>
  35. <field name="type">child</field>
  36. </doc>
  37. </doc>
  38. <doc>
  39. <field name="id">friend</field>
  40. <field name="type">other</field>
  41. </doc>
  42. </add>'
  43.  
  44. 5. Search again
  45.  
  46. curl "localhost:8983/solr/a/query?q=id:mother&fl=%2A%2C%5Bchild%20parentFilter%3Dtype%3Aparent%5Dā€
  47. You now only get "daughter" as child of "mother"
  48.  
  49. Why?
Add Comment
Please, Sign In to add comment