95 Commits

Author SHA1 Message Date
sam marshall
7ba2a20166 MDL-66326 Global search: Delete from index when courses are deleted
Adds new API support within search engines for optional methods to
delete data for courses and contexts, and implements this for the
two core search plugins (simpledb and solr).

The new API is automatically called when courses or contexts are
deleted. When a whole course is deleted, it only sends the course
delete rather than sending 1,000 separate context deletions as
each activity/block is deleted.
2019-08-23 11:51:50 +01:00
Andrew Nicols
221bfed37b MDL-66378 behat: Fix use of before/after selectors 2019-08-19 08:16:40 +08:00
Andrew Nicols
59008247db Merge branch 'MDL-60916-master_replace_course_search_wth_global_search' of https://github.com/gmrsagar/moodle 2019-08-14 10:35:22 +08:00
Amaia Anabitarte
82ca410f23 MDL-60636 behat: Fixing modified xpath 2019-08-08 11:58:03 +08:00
Sagar Ghimire
36667548b5 MDL-60916 core_course: Replace course search with global search 2019-08-05 16:05:10 +10:00
sam marshall
ed73ff2b0e MDL-66132 Search: Behat tests should use simpledb, fix mock count
When searching using mock results (the 'global search expects the
query' step), the result count is not correctly set. As a result, the
page incorrectly reports that there are no results and doesn't
correctly show the first page of multi-page results.

Additionally, some of the core Behat tests can now be moved to use
real searching with the simpledb engine, rather than using mock
results at all. This gives better tests.

Unfortunately it was not possible to move all of the core Behat tests
and deprecate the mock step, because some of the tests are related to
the UI for 'special' features searching by user or group, neither of
which are supported by the simpledb engine.
2019-07-12 15:31:30 +01:00
Dmitrii Metelkin
2085e8603a MDL-62869 search: implement searching for all courses 2019-03-01 07:18:37 +11:00
Eloy Lafuente (stronk7)
b16bb49192 MDL-60913 search: fix unit test expectation. Default is core-other 2019-01-23 23:02:41 +01:00
Dmitrii Metelkin
e9074ee381 MDL-60913 search: add search area categories 2019-01-23 10:28:43 +11:00
Dmitrii Metelkin
66f145efd1 MDL-62899 search: add document icons 2018-08-07 17:40:57 +10:00
David Monllao
74fc7d3120 MDL-62217 search: Privacy providers 2018-05-09 10:56:02 +02:00
sam marshall
a6cacdd266 MDL-61028 core_search: Allow filtering search by user (front-end)
Creates a new 'Users' field in the search filters form. This field
requires new JavaScript and, to implement this, a new AJAX-callable
web service to search for users by name, with detailed restrictions
based on the current user's access to view profiles.
2018-04-20 17:10:03 +01:00
David Monllao
b71ce36030 MDL-60953 search: Set solr as search engine for testing
Also replacing field label references for "All groups" references as
there is a mforms bug related to hideIf.
2018-04-17 13:26:21 +02:00
David Monllao
9dbb24fa7a Merge branch 'MDL-60953-master' of https://github.com/timhunt/moodle 2018-04-16 11:43:53 +02:00
sam marshall
a539e5605c MDL-61824 core_search: Deleting restored context caused error
When restoring content, this adds it to a queue for indexing. If the
restored content was then deleted before the indexing takes place,
this caused an exception in the scheduled task.

This change makes it continue safely past missing contexts.
2018-04-09 16:36:30 +01:00
sam marshall
3c49b0e6b6 MDL-60953 core_search: UI to search by group 2018-04-05 11:42:09 +01:00
sam marshall
fc440796e9 MDL-59434 core_search: Alternate result orders including by context
Implements a mechanism by which search engines can provide different
result orderings, and implements a 'by location' ordering within the
Solr search engine (available whenever the user starts their search
from within a course or activity).
2018-03-20 12:15:25 +00:00
sam marshall
163d280053 MDL-58885 core_search: Group support unit tests 2018-02-16 16:57:01 +00:00
sam marshall
4359ef18bb MDL-58885 core_search: Add group support
Adds group support to the core search API and the Solr search engine.
This allows for:

* User searching by group (in the API only, no interface yet)
* Automatically restrict search results by group (in some cases like
  separate-groups forums)
2018-02-16 16:57:00 +00:00
sam marshall
8736fbc190 MDL-60981 core_search: New indexpriority field in search index queue
Adds indexpriority field to the database table which holds a queue of
indexing requests. This allows for potentially large area reindexes
to have a lower priority, so as not to halt the special indexes that
run after a course restore.
2017-12-22 13:05:10 +00:00
sam marshall
25564a784b MDL-60981 core_search: Add get_contexts_to_reindex API
This new API returns a list of contexts for each search area. This
allows the areas to be reindexed in a sensible order (roughly
speaking, newest first) and also allows this to be controlled by
each area.

An implementation in the forum module means that forums are ordered
by the date of the most recent discussion, so that active forums
will be reindexed early even if they were created a long time ago.
2017-12-22 13:02:37 +00:00
Damyon Wiese
39377f8083 Merge branch 'MDL-44667-master' of https://github.com/snake/moodle 2017-12-12 10:26:08 +08:00
Damyon Wiese
6f7daa5e48 MDL-60880 core_search: Behat fix for clean theme
The navigation block is visible in clean so "I should not see courses" finds the link in the navigation block
2017-12-07 15:54:03 +08:00
Damyon Wiese
97812f14c1 Merge branch 'MDL-60880-master' of https://github.com/sammarshallou/moodle 2017-12-06 19:53:37 +13:00
sam marshall
7f9fb2c846 MDL-60880 core_search: Allow search of specific context (front-end) 2017-12-05 17:42:40 +00:00
sam marshall
cfa00fc565 MDL-60880 core_search: Allow search of specific context (back-end)
Adds back-end support for restricting searches to specified context
ids (for example so it is possible to search only a specific forum).
2017-12-05 17:42:38 +00:00
Jake Dallimore
3112c22004 MDL-44667 database: fix incorrect usages of $DB->get_field
Some places were passing 5 params, meaning the strictness param was
lost. This fixes those usages.
2017-12-04 16:53:51 +08:00
sam marshall
1b8cf12a59 MDL-60857 core_search: Improve cron log progress information 2017-12-01 15:47:22 +00:00
Jake Dallimore
e105a752c0 Merge branch 'MDL-60707' of git://github.com/aolley/moodle 2017-11-13 13:26:00 +08:00
Adam Olley
7f83e99e5f MDL-60707 core_search: In tests, use faked time for indexing length
Without this change its possible that the unit tests will fail at any time.
Before this change the indexing time is measured by real-time, not fake time,
making all index timings 0.

This happens as PHP offers no guarantee around the sort-order of an array for
any given two members that equate as equal. It just happens to pass for the
current array of search areas in vanilla Moodle.
2017-11-09 10:49:53 +10:30
David Monllao
7effd6dd79 Merge branch 'MDL-60720-master' of https://github.com/sammarshallou/moodle 2017-11-08 17:27:15 +01:00
sam marshall
4b0facc984 MDL-60720 core_search: Indexing halts on failed get_document
The recordsets used for search indexing sometimes return results
which are invalid (e.g. cannot be found in database). When this
happens, the result in the iterator for the recordset will be
false. Due to a bug, the iterator used to stop when it encountered
a false value, which prevented indexing from getting past the
problematic record.

In addition, the iterator that skips future data resulted in the
current() function of its parent indicator being called twice per
entry, which meant that search indexing called get_document()
twice as many times.
2017-11-07 16:36:37 +00:00
sam marshall
401710883b MDL-60705 core_search: Unit tests get time wrong by factor 1 million 2017-11-06 11:50:43 +00:00
sam marshall
82735dec4d MDL-60555 core_search: Change unit tests to use fake time
Using real time caused rare failures. I've changed it to use fake
measurement for the indexing timeouts, which were unit-tested.
2017-10-31 14:48:09 +00:00
Jun Pataleta
098f37c942 MDL-55356 search: Remove unnecessary var_dump call 2017-10-12 15:45:52 +08:00
Andrew Nicols
c1c6ed1b67 MDL-55356 search: Merge conflict fix 2017-10-12 11:54:04 +08:00
Andrew Nicols
ed15e64a3d MDL-55356 search: Insert non-empty default data in block fixture data 2017-10-12 11:53:06 +08:00
Andrew Nicols
e61ad18e70 Merge branch 'MDL-55356-master' of https://github.com/sammarshallou/moodle 2017-10-12 11:28:04 +08:00
sam marshall
74b7a42d0d MDL-55356 core_search: Make indexing task/CLI do context requests 2017-10-11 17:17:10 +01:00
sam marshall
4ba11aa907 MDL-55356 core_search: New manager API index_context
New function which uses the get_document_recordset function in
search areas to support full and partial indexing of a given
context.
2017-10-11 17:17:10 +01:00
sam marshall
427b756355 MDL-55356 core_search: New area API get_document_recordset
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).
2017-10-11 17:17:08 +01:00
sam marshall
eacb2bd11b MDL-55356 core_search: API to queue contexts for indexing
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.
2017-10-11 17:17:07 +01:00
sam marshall
2d2fcc1c9e MDL-60357 core_search: Future modified times cause serious problems 2017-10-06 13:38:32 +01:00
sam marshall
2d94d4ea7c MDL-59913 Global search: Allow search of non-enrolled courses 2017-09-29 16:30:37 +01:00
Eloy Lafuente (stronk7)
583b297d6c MDL-59926 behat: Make the search bootstrapbase + boost compatible
By combining the title attribute search with the "icon" class instead
of old "img" or new "i" elements we achieve that without too much
complication.
2017-09-14 01:26:30 +02:00
Eloy Lafuente (stronk7)
2e6112dd3f Merge branch 'MDL-59926-master' of https://github.com/sammarshallou/moodle 2017-09-12 00:27:49 +02:00
sam marshall
e36eefaeea MDL-59926 core_search: Allow Behat testing of results screens 2017-09-04 17:42:53 +01:00
Matt Porritt
4e921569d0 MDL-59459 Golbal Search: Increase file indexing coverage
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.
2017-09-02 10:28:17 +10:00
Simey Lameze
a14907faa8 MDL-58957 core_block: fix link to site home 2017-07-13 11:10:36 +08:00
David Monllao
afabbd110e Merge branch 'MDL-59039-master' of https://github.com/sammarshallou/moodle 2017-07-11 21:49:03 +02:00