cancel
Showing results for 
Search instead for 
Did you mean: 
mlattke
Instructure
Instructure

Good way to search content within a course?

Jump to solution

Does anyone have a good way to setup a search feature within a course?  I know that the Files tab has a search feature, but I'm looking more for content pages than files.  Here is the scenario.  We have a curriculum course with hundreds of pages of resources organized by grade level and subject.  A teacher can click through a series of buttons to browse to their desired resource, but the curriculum department wants teaches to be able to search for say "Poetry" and find all the pages on poetry.  I know this is not a built in feature, and I know I can submit a feature request, but I'm looking for an external tool or some other work around/clever idea that would let me do this in the short term.

Ideas I have thought of:

-Create an index page that lists all pages in a table of contents and use the browser search command on that page to locate a page. (downside -- hard to keep up as pages are added over time).

-Make sure pages are named with a clear naming convention and open the pages tab and use the browser search command on that page to locate a page. (downside -- when many pages are present, not all appear until you scroll, so you would not be able to search the ones that do not yet appear on the page using the browser search).

I don't think either of these ideas are particularly good, so I'm hoping that someone out there has an amazing idea for how to do this!

Thanks in advance!

ANOTHER THOUGHT:  Is it possible to use Google Site Search somehow?  I googled this, but couldn't find an answer.  😉

I thought maybe there was some custom javascript that could be embedded that would let site search crawl the pages.....anyone? anyone?

Message was edited by: Michelle Lattke

Tags (4)
30 Replies

 @mlattke ​, no answer yet, but I've noticed that

  1. Creating a Custom Search Engine on my entire site ( mcla.instructure.com/* ) yields results;
  2. Creating a CSE on my specific course ( mcla.instructure.com/courses/1572734/* ) does not yield results.

 @G_Petruzella ​, more to report:

1. CSE on my entire site also works.

2. Got CSE to work on one course

3. CSE still doesn't work on other courses

I have NO idea what is causing it to work on one course and not the other.....

-Did nothing different on the CSE setup

-Tried setting both courses up to have same public/privacy settings in Canvas

Here is a screenshot of one that works and one that doesn't.

CLASS THAT WORKED:

Screen Shot 2015-05-23 at 12.28.11 AM.png

CLASS THAT DOESN'T WORK:

Screen Shot 2015-05-23 at 12.30.18 AM.png

orwinr
Community Champion

I have successfully integrated Google Custom Search into my Technology training resources site by creating an html file that includes the GCS javascript with a note telling users all results will open in a new tab. Once you have created the html file upload it to your course files area and use a module item to create a link to the html file you just uploaded. When you click on the link in the module you have a nice custom search page embedded in your course. If you want to take it further use the redirect LTI tool to create a link in the left navigation menu. You can see our example at: iSchool Technology Training and find the search link in the left nav menu.

The code that is currently in my search.html file is:

<p style="color: grey;">All results will open in a new tab or window.</p>

<div>

<script>

  (function() {

    var cx = 'your search engine ID goes here';

    var gcse = document.createElement('script');

    gcse.type = 'text/javascript';

    gcse.async = true;

    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +

        '//cse.google.com/cse.js?cx=' + cx;

    var s = document.getElementsByTagName('script')[0];

    s.parentNode.insertBefore(gcse, s);

  })();

</script>

<gcse:search linkTarget="_parent"></gcse:search>

</div>

I hope you find this useful until we get search functionality in courses themselves. Just a note that only the pages and announcements areas appear to be searchable via GCS, or at least that is what I am finding, which totally makes sense. I also believe that your course has to be public for Google to crawl it, which also takes some time to occur on new pages. You can change the behavior of the custom search script through your GCS management console.

Randy

View solution in original post

naren_salem
Community Participant

Hi Randy,

I love what you have done to embed the search. Your solution is perfect and I wanted to add "Search" to the sidebar using the Redirect. How were you able to get the redirect to open the search.html file you have uploaded to the course? I.e. how do I get the URL to enter into the Redirect plugin.

Thanks for the great solution!

Naren

orwinr
Community Champion

Hi Naren,

It is a two step process after you have created the html file and uploaded it to your course files area.

  1. The first thing you need to do is go to the modules page in the left nav bar and add a new item that links to the html file in your course files area.
  2. After adding the link in the modules area, click on it to confirm that it works. If it works, right click (Control click on a Mac) on the link and copy the url of the link.
  3. Now that you have the link of the module item, go to the redirect tool and use that link in the configuration.

If all is well with the world, your search link will show up in the left nav bar 🙂

naren_salem
Community Participant

Thanks Randy! That worked. Just for the record, I am adding this to a course I have on the Instructure hosted instance of Canvas. Initially my searches kept returning 'No results'. I then requested Google to search my course using this site and then it worked:

https://www.google.com/webmasters/tools/submit-url?continue=/addurl

Also, Randy, I am not sure if you preferred to have your results open in a separate window or not. But I wanted to have the search result links open in the same window. I was able to get that by adding the linkTarget attribute in my search.html like so:

<gcse:search linkTarget="_parent"></gcse:search>

orwinr
Community Champion

Glad it worked Naren! Thanks for the tip on the results, I hadn't even looked for a solution so you saved me some time 🙂

wills004
Community Member

Hi everyone,

I'm not sure what the problem might be. I tried creating some general search engines (erau.instructure.com, .com/*, etc) and would get no results.  I tried it before asking Google to search, and afterwards (thanks to Naren's idea).  No difference.

I put the search.html into the Files of a course template, created a Module item, linked to search with FILE, and when I run the search it finds a lot of the "out there in the wide world" items (well, 15 of them with the word "network" in canvas pages, that is), but nothing in the course itself.  IN FACT... the only site I see is canvas.uw.edu and subpages...

Any ideas?

Could there be something that my school's site administrator has done that blocks this google search engine from looking internally?

Thanks,

Mike

naren_salem
Community Participant

Does your search work by itself? As in, if you ran your search.html without embedding in Canvas, does it work?

I am guessing it is not, because it sounds like you are having trouble with the indexing part where Google creates your custom search engine.

You may be right in thinking this may be an issue with the site admin settings. Also when I was trying this, it only works if the course was set to be public - Google can't see the lessons if there is a password.

Ultimately I gave up on this - our course needed a password, and also the way Google was doing this was a bit mysterious. I ended up writing my own search engine for the course.

orwinr
Community Champion

Mike, if your search.html file is configured correctly and you have a Google Custom Search ID, your results should only contain items from your course. In the course that I shared when I created the scenario above, I just did a search for the term "Jing" and got 17 results. All results were from this course, with the obligatory ads at the top of the results list. As I pointed out and   @naren_salem ​ pointed out, the search only works if your course is public. If it isn't public Google can't crawl it and maybe we can get  @naren_salem  to tell us about the custom search tool he wrote for his course.