-
Bug
-
Resolution: Fixed
-
Minor
-
3.2.5, 3.3.2, 3.4
-
MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
-
MOODLE_32_STABLE, MOODLE_33_STABLE
-
MDL-60357-master -
(I am setting up search on some of our test systems and consequently finding problems!)
The search indexing process works based on modified time (usually a 'timemodified' field), roughly like this:
- Get all documents newer than the previous indexed time (in time order)
- Index all those documents
- Set the indexed time to the modified time of the last document
Supposing there are some documents where timemodified is set in the future (e.g. 2020), this causes a serious problem, because the indexed time will be set to the future. Next time it tries to index, it will only be looking for documents since 2020, and it will never index all the new documents added (with correct time) between now and 2020.
Incorrect timemodified values can happen in various search areas, usually due to incorrect backup/restore implementation. These may also exist in historic data that hasn't been touched for ages. As a safety measure, I propose the following solution:
- Do not index any document with timemodified in the future.
(The other option was to just prevent it setting indexed time in the future, but if we did that, it would repeatedly index a stack of 'future' documents every single time indexing is called, which is poor.)
This might cause problems when somebody restores a site and it gets the dates wrong as then it would never index those items, but restore generally doesn't work with search indexing anyway, and that would be resolved by my fix to MDL-55356. It's better to have the occasional screwed-up document not being indexed than to prevent all indexing of documents until some distant future date as present...
I will submit a fix for this bug soon. Given all the other changes in search it will probably be easiest if we fix only in 3.4+ although it would be possible to do a fix for earlier versions too if required.
- caused a regression
-
MDL-60720 core_search: Indexing halts on failed get_document
- Closed