Details

    • Testing Instructions:
      Hide

      Unit test coverage is pretty good, but unfortunately we can not add behat tests as all this depends on external software so we need some manual testing.

      Installation

      1. Follow only 'Installation' section in https://docs.moodle.org/dev/Global_search#Installation (this page will be moved to 31/Global_search_solr)
        • After this you should have a working solr server with an index instance for moodle

      Setup

      1. Upgrade moodle
      2. Relax, it is not as bad as it seems
      3. Go to site admin -> plugins -> search
      4. Enable search should be disabled by default
      5. Open a new tab and go to your dashboard, press 'Customise this page' and add a global search block
      6. You should be able to add it and you should see the following message inside of it 'Global searching is not enabled.'
      7. Leave this tab open, return to Manage global search and enable it
      8. Return to your dashboard, now you should see a search form where you can filter by area
      9. Type something and press search
      10. You should be redirected to search/index.php and you should see 'No results'
      11. Close this tab and return to the previous one
      12. Go to site admin -> plugins -> search -> solr and save changes (basically set host to localhost, port to the default 8983 and indexname to moodle)
      13. Open a CLI and while in moodle's root execute php search/engine/solr/cli/setup_schema.php
      14. It should finish saying something like Adding moodle fields... and The schema is ready to be used
      15. Run again the same script, no exception should be triggered and you should see something like Adding moodle fields... and The schema is ready to be used

      Indexing & searching

      1. Go to reports -> search
      2. Use tool_generator to generate a few courses with forums if your site don't have much data (we will need forum posts)
      3. Tick recreate index and save changes. I hope you don't have many many forum_posts this will send them to the search engine, may take a bit of time if you have thousands and thousands posts, take a break, you deserve it
      4. At some point this will finish and will show a 'Indexing finished' and the screen last run numbers will be updated with some numbers
      5. Open your dashboard in a new tab and use the global search block to search something you know that your forum post contain, for example 'forum'
      6. You should see the list of results including that search string
      7. Click all links in one of these results, they should all be valid results
      8. When you have more than 10 results you will see pagination links, try that these pagination links work
      9. Search something else with valid results and check that you can see results
      10. Search something else with a crazy query string like dfsghuasdguhisdfgui and check that you can not see results
      11. If will be nice if you can look at the query field help and try some combinations
      12. Return to reports -> search browser tab and tick 'Delete' checkbox, 'Entire index' should be selected already, press "Save changes"
      13. Back to dashboard, search a valid result, you should not see results now
      14. Filter queries are unit tested but it will be nice if you can look at the results you get and try some query combinations checking that the results you get are correct

      Unit tests

      1. Go to the directory where you installed solr (/something/solr-5.4.1 probably)
      2. Run bin/solr create -c unittest
      3. Add TEST_SEARCH_SOLR_* vars in your config.php (see search/engine/solr/tests/engine_test.php php-doc block)
      4. Run vendor/bin/phpunit search/engine/solr/tests/engine_test.php and check that the tests are executed and not skipped, they should pass
      5. Run the whole phpunit suite, everything should pass
      Show
      Unit test coverage is pretty good, but unfortunately we can not add behat tests as all this depends on external software so we need some manual testing. Installation Follow only 'Installation' section in https://docs.moodle.org/dev/Global_search#Installation (this page will be moved to 31/Global_search_solr) After this you should have a working solr server with an index instance for moodle Setup Upgrade moodle Relax, it is not as bad as it seems Go to site admin -> plugins -> search Enable search should be disabled by default Open a new tab and go to your dashboard, press 'Customise this page' and add a global search block You should be able to add it and you should see the following message inside of it 'Global searching is not enabled.' Leave this tab open, return to Manage global search and enable it Return to your dashboard, now you should see a search form where you can filter by area Type something and press search You should be redirected to search/index.php and you should see 'No results' Close this tab and return to the previous one Go to site admin -> plugins -> search -> solr and save changes (basically set host to localhost, port to the default 8983 and indexname to moodle) Open a CLI and while in moodle's root execute php search/engine/solr/cli/setup_schema.php It should finish saying something like Adding moodle fields... and The schema is ready to be used Run again the same script, no exception should be triggered and you should see something like Adding moodle fields... and The schema is ready to be used Indexing & searching Go to reports -> search Use tool_generator to generate a few courses with forums if your site don't have much data (we will need forum posts) Tick recreate index and save changes. I hope you don't have many many forum_posts this will send them to the search engine, may take a bit of time if you have thousands and thousands posts, take a break, you deserve it At some point this will finish and will show a 'Indexing finished' and the screen last run numbers will be updated with some numbers Open your dashboard in a new tab and use the global search block to search something you know that your forum post contain, for example 'forum' You should see the list of results including that search string Click all links in one of these results, they should all be valid results When you have more than 10 results you will see pagination links, try that these pagination links work Search something else with valid results and check that you can see results Search something else with a crazy query string like dfsghuasdguhisdfgui and check that you can not see results If will be nice if you can look at the query field help and try some combinations Return to reports -> search browser tab and tick 'Delete' checkbox, 'Entire index' should be selected already, press "Save changes" Back to dashboard, search a valid result, you should not see results now Filter queries are unit tested but it will be nice if you can look at the results you get and try some query combinations checking that the results you get are correct Unit tests Go to the directory where you installed solr (/something/solr-5.4.1 probably) Run bin/solr create -c unittest Add TEST_SEARCH_SOLR_* vars in your config.php (see search/engine/solr/tests/engine_test.php php-doc block) Run vendor/bin/phpunit search/engine/solr/tests/engine_test.php and check that the tests are executed and not skipped, they should pass Run the whole phpunit suite, everything should pass
    • Affected Branches:
      MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Epic Name:
      Global search
    • Pull from Repository:
    • Pull Master Branch:
      MDL-31989_master
    • Story Points (Obsolete):
      20

      Description

      Global Search is currently removed from Moodle 2.2.

      As part of GSoC '13 project, I've re-written Tomasz Muras's Global Search implementation for the current 2.6 (dev) master branch.

      You may view the demo and play with it here: http://global-search.jmuras.com/
      ( Username:search_admin Password: Search_admin1 )

      The docs are here: http://docs.moodle.org/dev/Global_search

        Gliffy Diagrams

        1. Screen Shot 2016-02-22 at 16.53.33.png
          32 kB
        2. search-block.png
          12 kB
        3. search-results.png
          103 kB
        4. search-setup.png
          94 kB
        5. search-solr-setup.png
          150 kB

          Issue Links

            Issues in Epic

              Activity

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  23/May/16