hotosm / learnosm

LearnOSM.org content, Jekyll layouts & issue tracking. This repository is dedicated to helping people learn how to map in OpenStreetMap (OSM) and use many of the software and tools in the OSM community.
http://learnosm.org
MIT License
248 stars 189 forks source link

Proper search indexing in-page text #150

Open harry-wood opened 10 years ago

harry-wood commented 10 years ago

Currently the search on LearnOSM.org is jquery Autocomplete with only the chapter headings loaded in (More info on this old issue) Not a massive priority, but maybe somebody fancies thinking about how this can improved to match on text within the chapters, which will involve implementing it completely differently.

For bonus points we should note that learnosm.org has "proper" content pages, and also a number of links to google docs at the moment. I guess ideally those might be indexed too.

We could run a proper indexed search system such as "lucene", but I don't know how easy it is to set-up or what would run better on this server.

Serverless solutions including embedding google search or the less evil duckduckgo

CloCkWeRX commented 9 years ago

Elasticsearch is pretty easy to set up - for example; https://github.com/elasticsearch/cookbook-elasticsearch

http://www.elasticsearchtutorial.com/elasticsearch-in-5-minutes.html#Indexing is how you can use it.

Plugins like https://github.com/codelibs/elasticsearch-river-web make it easy to index sites.

As you say, the quickest solution may be embedded google though

CloCkWeRX commented 9 years ago

Just made a google custom search engine; under these terms: https://support.google.com/customsearch/answer/1714300

Embed code:

<script>
  (function() {
    var cx = '013113174346174561421:rf_zkfu3yv0';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>

Styling details: https://developers.google.com/custom-search/docs/element

CloCkWeRX commented 9 years ago

image

image

and results open in a new tab.

bgirardot commented 9 years ago

One thing to note about search terms and using external 3rd party searching, especially google, is that our new stats software, piwik, might not get search terms information in that case.

Nick-Tallguy commented 9 years ago

Just a comment - current search uses the line from the header 'title' and searches on any words in that title: title: Remote, Armchair or Mapathon editing will get hits on any of the words remote, armchair or mapathon. See also #315 which may have a solution outlined.