Open jidanni opened 3 years ago
I just wrote about this on my diary! This would be a lovely feature to have.
There was an interesting suggestion in the comments section of my diary entry. It seems that search engines are pretty capable to handle a diary-specific search given the right syntax. I am guessing most users coming across the User Diaries page do not know how to compose a search command like this. So I suggested (copying from the diary comment):
Perhaps there is a way to create a search box that parses whatever the user enters and redirects (new tab) to search engine results. So a user would enter, for example,
openstreetcam
and this would open a tab withhttps://duckduckgo.com/?q=site%3Aopenstreetmap.org%2Fuser+diary+%22openstreetcam%22
.
As an added bonus, it would expose more users to a privacy-centered search engine.
Would that be a feasible implementation of this?
Someone suggested documenting search strategies using existing external search engine syntax, so I took the User Diaries OSM wiki page (which was a redirect) and added some hopefully relevant content there.
Here's a summary of the search methods we've explored for the diaries page:
PostgreSQL LIKE
Search:
LIKE
operator for basic text searching.entries = entries.where("title LIKE :query OR body LIKE :query", query: search_query)
pg_search
Gem:
pg_search
gem.Code:
include PgSearch::Model
pg_search_scope :search_by_title_and_body,
against: [:title, :body],
using: { tsearch: { prefix: true } }
entries = entries.search_by_title_and_body(params[:search])
Trigram Indexes:
pg_trgm
for faster searches with some relevance ranking. This adds complexity with new database migrations.External Search Engines:
Your feedback will help determine the best approach.
Ref Is there way to search users' diaries in OSM?, OSM Help Forum (OSQA) - November 17, 2015 (and similar comment in reply by mmd-osm)
Use cases; i.e. users looking for user-created guides besides wiki. Related use cases based on https://github.com/openstreetmap/openstreetmap-website/issues/1362#issuecomment-259432522
search/filter diary entries from friends. moderate diary entries. search/filter diary entries near users changesets. etc etc.
(sidenote: searching by date range is not mentioned in browser search engine example on earlier mentioned wiki page.)
On https://www.openstreetmap.org/diary add a box to search, for e.g.,