We were previously testing tha the parent is valid, which it was, and
then fetching the current record, before fetching data from it.
However, the way in which the recordset walk works, the valid function
checks whether the _record_ itself is valid, whilst the current allows
for a callback to be applied.
In this instance, the data-entry was failing because the count of
indexfields was < 2. The recordset data itself was valid, but the view
was not, and as a result, the current() function returned false.
This false was not previously handled.
I've changed the logic so that we handle this case, and have removed a
double-negative in the process.
The search area API now includes a new function get_document_recordset
which should be implemented in preference to the older
get_recordset_by_timestamp. (It's also possible to implement both in
plugin search areas which need to work against older Moodle versions.)
Existing search areas without the new function will continue to work as
before (obviously without the new functionality).
New API \core_search\manager::request_index($context, $areaid = '')
adds the given context to a list which is intended to be indexed
later by the scheduled task.
New function \core_search\manager::is_indexing_enabled(), analagous
to existing is_global_search_enabled().
This replaces existing duplicated code, ready for more use in
following commits.
If an indexed file has been modified or deleted the search index
will still reference the old file. Remove the file from search
results until the change has been indexed.
Increase the scope of the files that are detected and
indexed by Moodle's Global Search. This includes intro
and content areas of search areas. The use case here is
in a description for an activity there is a file added
that contains more information about the activity.
It would an advantage to be able to search this content
as well. It would also allow search engine plugins to be
able to index non text files such as images.
Allow Global Search 3rd party engines to be much faster by supporting batch processing.
Refactor the iterator loop for the documents to add to the search index into its own method.
Move this new method from the manger class to the base engine class.
The move to the base engine class will allow search engine plugins to override this and determine
how they implment it. It will not break the existing interface contract with existing plugins.
Finally, add an elasped time indication to the trace output.
Also removing is_server_ready call from execute_query as in production
workflows search is done through \core_search\manager::search and
\core_search\manager::instance already checks is_server_ready. In
testing environment setUp functions should check that the server is
ready before performing other actions.