79 Commits

Author SHA1 Message Date
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
sam marshall
67d6479581 MDL-59039 Global search: Allow partial indexing (in scheduled task) 2017-07-11 16:41:33 +01:00
sam marshall
902be008db MDL-58957 Global search: Unit test for block searching 2017-06-30 13:10:14 +01:00
sam marshall
a96faa49a8 MDL-58957 Global search: Add block support to search manager 2017-06-30 13:10:12 +01:00
Andrew Nicols
674de8e51e Merge branch 'MDL-55191_master' of git://github.com/dmonllao/moodle 2016-09-20 11:41:03 +08:00
David Monllao
e71061a22b MDL-55191 search: Generate an search result viewed event 2016-09-15 09:36:49 +08:00
Eric Merrill
1aaead91f9 MDL-55725 search: Index proper time modified with indexed files 2016-09-07 17:33:28 -04:00
David Monllao
f3d38863fe MDL-55390 search: is_search_area unit tests
Added extra checking for search manager get_search_area.
2016-08-09 15:51:30 +08:00
David Monllao
0bd8383a8b MDL-55278 search: Updating references to area namespace 2016-07-21 18:38:18 +02:00
Dan Poltawski
b76edf3cfa Merge branch 'MDL-54926-master' of git://github.com/merrill-oakland/moodle 2016-07-11 16:54:40 +01:00
Dan Poltawski
64ec975e19 Merge branch 'MDL-55082-master' of git://github.com/merrill-oakland/moodle 2016-07-11 15:20:48 +01:00
David Monllao
6a4c2146f9 MDL-53222 search: Replace report_search by new searchareas admin page 2016-07-11 11:49:14 +02:00
Eric Merrill
55b62370aa MDL-55082 search: Update core areas to return results in time ASC order 2016-06-30 11:11:35 -04:00
Eric Merrill
4e2b5191d4 MDL-54926 search: Reduce over-escaping in results 2016-06-28 16:33:29 -04:00
David Monllao
25ba053ff2 MDL-54707 search: Add user context to get_areas_user_accesses 2016-06-26 21:23:16 +02:00
David Monllao
724703d3e1 MDL-53170 search: Specify core_course mycourses search level 2016-05-11 17:22:24 +08:00
Eloy Lafuente (stronk7)
33952d4a53 Merge branch 'MDL-53758-master' of git://github.com/merrill-oakland/moodle 2016-04-26 20:34:20 +02:00