Microblog : A very long article Wikipedia article on the orientation of toilet paper [7 jun à 22:52] [R]

Jeudi, 23 février 2023

Full-Text Search in Database For Mastodon

Traduction: [ Google | Babelfish ]

Catégories : [ Informatique ]

I run my own instance of Mastodon on a server with little memory, i.e. not enough to be able to run ElasticSearch in addition to Mastodon. This means that I cannot do a full-text search on my toots (which would have come handy from time to time).

As an alternative solution, I have implemented a full-text search on database. It is most probably not suitable to use on a large instance, as the implementation uses an SQL query with multiple LIKE conditions ORed together. That's not the most efficient way of querying a database, but for a small enough number of statuses (40k at the moment), it's probably good enough.

This feature is (and will probably forever remain) experimental, but if you want to give it a try, and assuming that you have installed Mastodon from Git like me in /home/mastodon/live and run v4.1.0, here's how to do it.

As user mastodon, run:
$ cd /home/mastodon/live
$ git remote add db_search https://weber.fi.eu.org/software/mastodon
$ git fetch db_search
$ git checkout v4.1.0+db_search.1
$ echo "FULL_TEXT_DB_SEARCH=true" >> .env.production
Then restart the mastodon-web service by running as root:
systemctl restart mastodon-web.service

Reload the mastodon Web UI in your web browser. When you click on the search box, you should now see a message like “Simple text returns posts you have written…” and searching with words you know you have written should display matching toots.

EDIT: I expanded the search to also consider the descriptions of media attachments. The updated version is available as tag v4.1.0+db_search.1.

[ Posté le 23 février 2023 à 14:56 | pas de commentaire | ]

A Million Ways to Die in the West

Traduction: [ Google | Babelfish ]

Catégories : [ TV/Cinéma ]

https://en.wikipedia.org/wiki/A_Million_Ways_to_Die_in_the_West

Wikipedia

Albert Stark is a sheep farmer in Arizona in 1882. After his girlfriend Louise broke up with him because he refused to defend himself in a duel, he decides to leave for San Francisco. Lewis, a bandit, arrives in town with Anna, his boss's wife. Lewis quickly gets arrested for having killed the pastor's son in a saloon fight, during which Albert saves Anna from being killed and they become friends. At the fair, Albert impulsively challenges Louise's arrogant new boyfriend Foy to a shooting contest, and during the next week, Anna teaches Albert how to shoot. During a barn dance the night before the fight, Anna drugs Foy with a laxative, leading him to forfeit the fight the next day. The next day, Anna's husband Clinch arrives and, having learned from Lewis that he had seen a man kiss his wife, threatens to kill people unless the man duels him the next day. Clinch takes Anna with him but she escapes and goes to Albert's farm to warn him about Clinch, who arrives soon after. Albert helps Anna to escape before escaping himself to the mountains where he is captured by a tribe of Apaches. As Albert can speak their language, they won't kill him and instead give him a bowl of peyote during a ceremony. The vision makes him realize he loves Anna, despite her lying to him about being married. Meanwhile, Clinch captures Anna, then duels with Albert. The latter grazes Clinch with a bullet dipped in rattlesnake venom and manages to stall him until he dies from the poison. Louise attempts to win back Albert, but he rejects her and enters a relationship with Anna. With the bounty for killing Clinch, Albert buys a lot more sheep.

[ Posté le 23 février 2023 à 12:19 | pas de commentaire | ]