Steps to reproduce: Unfortunately, this issue has no easy steps to reproduce. Basically, to reproduce, some documents need to exist in the database but not in the search index (or vice-versa). For example, in a space that has a child space, create a document that is alphabetically after all other documents and prevent that document from being indexed in Solr. Expected result: On restart, XWiki re-indexes just the added document. Actual result: On restart, XWiki re-indexes also the whole nested space and not just the added document. The reason for this is that the comparator that is used internally for merging the results from the database and Solr sorts nested spaces first while both Solr and the database sort the nested spaces last. There are further differences, this can be seen with an integration test that checks if the sort order that is returned by Solr or the database is consistent with the used comparator. |