Announcing a new Search Engine for Lemmy

marsara9@lemmy.world to Fediverse@lemmy.world – 1576 points –
search-lemmy.com

I shared bits and pieces of this before, but it's officially up and running now: https://www.search-lemmy.com/

This is an enhanced search engine for Lemmy. With a few primary goals:

  • You can choose a preferred instance. After choosing what your primary instance is, and performing a search ALL links will open in that instance.
  • This aims to be a replacement for using site:reddit.com in Google, but just for the fediverse.
  • You can filter the search results by:
    • Instance -- This will filter the results to only show communities that belong to a particular instance. Just type something like instance:lemmy.wrold or instance:https://lemmy.world/. This is separate from your preferred instance, such that you can search for posts on lemmy.world while still opening them on lemmy.ml.
    • Community -- You can refine the search by a specific community. You use the same syntax that you'd use here community:!fediverse@lemmy.world.
    • Author -- Similar to the above you can also filter by a specific author such as: author:@marsara9@lemmy.world.
  • The entire thing is open-source. You can view the code and even host your own instance... See more details here: https://github.com/marsara9/lemmy-search.

NOTE: This only supports Lemmy instances for now. Other fediverse type instances may be in the future depending on how this works out.

I've been working on this over just the last few weeks, so it hasn't had a chance to crawl much of the fediverse yet. For now it only supports lemmy.world and lemmy.ml but other preferred-instances will come online as time goes by.

If anyone finds any bugs, and I'm sure you will, or if anyone has any suggestions PLEASE raise an issue on GitHub for me to track. Lastly, if anyone wants to help contribute please feel free to reach out.

NOTE TO SERVER ADMINS: You can prevent your site from being crawled by adding lemmy-search to your robots.txt for the user-agent.

149

Thanks for this! I was trying to figure out how to best replace the old "site:reddit.com" trick, and it did not quite work with lemmy with how it is federated. I hope that longer term we can get an "all" tab on lemmy that truly tries to pull from as many of the federated sites as possible to get us closer to the Reddit experience. I tried to do some research on extreme heat clothing due to the wet bulb temps in my area but r/mensfashion and most other clothing reddits still seemed private, maybe I can try searching with your solution now.

Looks like your comment got triple posted. The lemmy instances are getting slammed lol

Well, we were probably already due or going on past due for something to best replace the old "site:reddit.com" with "site:lemmy.world" for instance.

Holy fuck I've been thinking about how annoying it is that I can't search lemmy for a few days now - and here you are suddenly just handing the tool I want to me with features that I didn't even think about. THANK YOU SO MUCH. Adding this post to my saved.

This is great! I was so annoyed by the links not going to my home instance that I made this userscript (Lemmy post)! It rewrites all links on all websites to always point to your home instance.

Could be a nice addition for everyone that likes this website :)

Are the search result links not opening on your home instance? If so please raise an issue on GitHub with your home instance URL and I'll investigate. But you should be able to select your home instance from the drop-down and then search and all of the results will have their links direct to that instance. (This does require that your instance has been indexed by the search engine, which as of this moment I've only indexed 278 of the nearly 1000? Lemmy instances out there.)

I think you misunderstood. You were annoyed by links not going to your home instance when searching so you made this website. I was annoyed by all links everywhere not going to my home instance so I wrote the script. They're both tools that help achieve the same thing so I felt right to post mine here, too :)

Nobody has mentioned it yet, but https://fedi-search.com/ already exists

Yes but that search doesn't take you to the instance that you are logged into already. Which is one of my main goals with this site. While that did give me the inspiration for this and has the power of Google behind it, it lacks knowledge about how the fediverse actually works.

Can it filter NSFW posts? As on Reddit you can search "pussy nsfw:no" and get pictures of cats.

Wondering if this will see the same backlash that Mastodon had when users were planning to add a search engine - many users moved to Mastodon specifically because their posts are unsearchable by default, and that prevents some dogpiling that was common on Twitter.

Great heads up

I just don’t get why people would join SOCIAL media if they don’t want to their posts public. Its like having a group meeting in the middle of a public square and complain people saw them

Maybe they should just use discord or or private communities instead

I've already got some complaints about that. You can see one of the issues raised on GitHub.

At the moment, I'm only picking up mastodon posts that are federated to Lemmy, but you can't choose Mastodon as a preferred-instance, yet. When and/if I decide to add Mastodon support, I'll reach out to the admins over there to get feedback first.

Edit and note to any server admin: If you want to block the crawler from hitting your site, just add lemmy-search to your robots.txt and crawling will be prevented. But this doesn't stop cross-federation posts from being picked up on another instance.

Thats very considerate of you

Please don’t take those complaints as negative feedback. I don’t think Lemmy is designed to be private and your search engine would be a great of help to the whole community.

By the way, do you plan to create a community to discuss about your search engine? Maybe users can help you with testing or report issues or improvement

I've got a discord page up and going that is invite only right now. No offense to anyone here but i didn't want to be overwhelmed with users joining in on the discord chat just yet. If you want to help contribute or even just test you can easily find me on discord, and I'll give you an invite.

Starting a Search-Lemmy community here might be good for visibility too.

If anyone wants to start one up... by all means. I'm not really one to moderate an entire community. At least not yet.

Yeah I hear you. I've thought several times about starting niche communities that aren't here yet but I just am not capable or even able to be a moderator.

By the time they gain traction you can hand them off.

Is it “lemmy-search” or “lemmy-server”? The post and this comment seem conflicting (if I didn’t miss something)

Thanks for that, fixing. But it should be lemmy-search.

I think it makes sense for a “redditlike” to be searchable, while also understanding that Mastodon is a different beast and can benefit from lack of search.

Don’t know if Mastodon posts on Lemmy instances have a specific characteristic, but perhaps you can consider filtering them out while keeping “regular” Lemmy posts and comments?

I think the use case and the default expectations about search are pretty different on Lemmy, but I can definitely see this being a potential point of friction, particularly since most content is actually structured by community rather than instance, and in many cases it would make more sense to exclude stuff based on the community it's posted to or the individual user than by instance. (But I'm sure that wouldn't be immediately technically feasible.)

Ya Lemmy organizes everything under a community technically. I mean I can filter on any piece of data I can get my hands on, but what makes the most sense. For MVP I chose to just grab whatever the API would give me. But then the question comes, if I do start filtering results, how do I determine what to actually exclude... long story short -- not an easy problem at least initially.

Lemmy is not private in any way. In fact, while the OP's project is really cool and admirable, there is already https://fedi-search.com, which searches top Lemmy instances (and kbin, Mastodon, and peertube) using regular operators behind the scenes in Google, Bing or DDG (whichever you prefer), because those search engines already crawl Lemmy along with the rest of the internet, unless the site owners block crawling via robots.txt.

TBH they can block them from search in the preferences. Otherwise anything on the Web is searchable and findable.

1 more...

Can you tell me how to use search-lemmy to find this post that I created yesterday?

Getting started with net-snmp in C++

When searching for "snmp" I get zero results. When searching for "net-snmp", I get 37 unrelated results, none of which is my post.

It might not have been crawled yet. The search engine will periodically search for new content but this isn't instant. So it may take a day or two to find it.

still not working - is this possibly because of the server being overloaded & the crawl not working? relevant query

PS: is it too much load on your search engine to search across all instances by default? Atm it auto-selects the first in the dropdown list as the preferred instance.

Search engines take time to crawl websites to find content. Right now I'm using lemmy.ml as my source of truth. So:

  1. The post in question must have been federated to Lemmy.ml
  2. The crawler then has to discover that post. Right now it's only scheduled to run on demand, as it's still doing it's initial crawl. So it won't get around to checking Lemmy.ml for new posts for a few days. Eventually it runs once every 6 hours, once it's caught up.
  3. Lastly, it has to cross-reference that post on your preferred instance. This is what the crawler is doing right now. It's taking every post it found on lemmy.ml and trying to find the same post on every other instance.

P.s. the last step is only required because there's no way to hotlink to a post today as the URL uses an internal identifier. There's an open GitHub issue on this for Lemmy itself. When/if that is resolved I might be able to speedup the discovery of new content by skipping the cross-referencing step altogether.

P.s. As for the auto-select thats a known bug and I hope to have it fixed soon.

Hello, I commented about a bug in the instance selector on a cross post, not realizing that wasn't the actual developer. Not sure if it's related to what you're talking about here, but I wanted to bring it to your attention. Great project by the way!

https://lemmy.ca/comment/829227

Replied to your comment there. I'll definitely look into that bug tonight. But I'm still exploring ideas to make instance selection easier ...

Cool! Is there a way to search all instances at once?

Due to a one of my primary goals of having links open in your home instance, you can only search a single instance at a time.

There's an open issue about this though but it requires some changes to Lemmy itself to work.

Not wanting to undermine your excellent work, what would be the specific advantage yet, compared to searching for communities / posts via the lemmy page?

I am completly New to lemmy or reddit and still searching for a nice and easy way to find relevant threads for me

The built in search, well sucks. Search for "Not undermine wanting" and you won't be able to find your comment. Essentially:

  1. All words are required
  2. The order of each of the search terms is important
  3. The search results here provide no ranking.
  4. The searching here is relatively slow. (now some queries on my site are slow as well, but most should be fast)

Ahhh i think i got it - so it is not a search for communities but for full text

It then makes sense to me why i need toselecft an instance beforehand.

Really nice work! I was excited since we talked about it, and it definitely delivers imo!

Ya, now if everyone can stop finding bugs! So I can take some time off. /jk

Haha yeah! You might have to resort to an internet-less vacation :p

take time off whenever you need :D Im sure people would rather you go far than go fast

make those results sort- and exportable (CSV, JSON, XML or the like), and you could be the new redditsearch.io. especially filtering results by different community/time/author would be great, and sorting by length/upvotes. what was that site with reddit post statistics called again? I know, this all might be further out, and wrangling bugs, the changing API and cloudflare might be more pressing issues, but maybe put it on the feature request list somewhere? all the best, and thank you for making this!

There is a public API now. While I won't support sorting, you can process and do what you will with the results as-is. Currently I only support Posts and Communities for now.

When you search for posts you're just matching against the title or body. For communities it's searching the posts within that community.

There's also more filters now with: instance/community/author/since/until and a safe-search option.

So I'm not sure how close this comes to your idea but I thought I'd share.

Not very knowledgeable on programming, but isn't there a way to implement this code with the Lemmy/fediverse devs to integrate this to the site and afterwards to the different apps used to browse it?

Great contribution regardless, thanks for your work!

See one of my other replies. But that was a thought originally. Just hook into the original database instead of crawling using the APIs. Problem is, the table structure required to search is much different than that of a community form. At least if you want to do searches quickly. It takes me almost 5-10 seconds just to process 50 posts at the moment, and I'm doing those in batches... but ya maybe in the future I can talk to the Lemmy devs and see about merging these two projects?

I really really hope, one of the things I'm loving about the idea of Lemmy or the fediverse is the cooperation aspect, at least in jerboa which is the browser that I am using for now, there is a sense that anyone is pitching in either ideas or actually implementing them, and I guess Lemmy devs are of the same mentality. Anyhow, let's hope you can merge them and optimize in the future, it would be huge, congrats and good job again.

It says I am blocked from using it. Any reason?

Same. I guess it is some Cloudflare service to prevent DDoS attacks or something

Blocked by cloudflare ID 7e0ba74959214ac0 Client Thunder (Android) Instance lemmy.world

hmm, site:lemmy.world cat

"some search string instance:lemmy.world".

Keywords are:

instance:<instance name>

community:!<community name>@<instance name>

and

author:@<author name>@<instance name>.

P.S. to those trying to use a filter, I have a bug that's been discovered: https://github.com/marsara9/lemmy-search/issues/13

Long story short, make sure to put your query first and the filter at the end (with no space between the simicolon)

Still not working for me, my test query (following the example's format) is:

Genshin instance:https://lemmit.online/

Nevermind, found the issue already. I should have a fix uploaded tomorrow. Looks like all instance lookups are failing.

Ya I'm looking into this one already. I've got a bug report for it. Might take a day or two to figure out what's going on.

2 more...
2 more...

Can't wait for all the various lemmy tools to be integrated into lemmy UI

Hoping there will be a way to integrate it with kbin soon!

I can't give a timeframe on Kbin yet, as I want to get it as stable as possible with Lemmy. fist. But I think Kbin will probably be next on my radar as the overall structure of the two platforms is very similar.

Hey, just a heads up, your server seems to be down at the moment.

Thanks, not sure what's going on... I can still see it crawling in the background but ya it's not loading... I'm not anywhere near my bandwidth maximums yet, it doesn't seem.

With the new third party apps coming up, maybe they can use your search engine. TAP connectivity!

It should be back online now. Looks like Nginx crashed?

If I use this search engine instead of the one on the website, does it mean it would put less strain on the server? Yeah, I'm not quite techy.

If so, I guess this a big is step.

Fine addition to my keyword/bookmarks library.

All I need now is the option to sort by New.

If I use this search engine instead of the one on the website, does it mean it would put less strain on the server? Yeah, I’m not quite techy.

Yes. Searches on my site only hit my server and don't touch your home server unless you click on a link.

Update: I'm hoping I got the stability issues fixed. I'll know more in the next 24hrs though.

fantastic work lemmy team. with this page I feel like lemme will do it and lemmy tell you, reddit will suffer a big loss!!

Thank you! You are my hero. I was really wondering what I was going to do to replace my "site:reddit.com" search habits in Google and here you come with this wonderful tool.

It amazes me how talented people are. Imagine whats going to happen if all the talented people start workinng on Lemmy

Yeah! Going to replace my googling for something like "<search> reddit"

Yes Sam. I'm all on board this lemmy train but that was the one thing I was going to miss from doing my Google searches. Hopefully at some point let me will be popular enough that I can replace most of my forums and searches with Lemmy

This looks good, I just found an old (3 year old post - I didn't even know Lemmy was around back then!) and commented on it. There were also funnily two other recent comments (one from 2 months ago and another 3 months old).

oh wow this is great. wish it were easy to use this search from a lemmy instance and browse the results from within.

Heck I wouldn't have to crawl the sites if that was the case. I could just have the data already available. Only problem is, it takes a good 5-10 seconds right now to process 50 posts, so if you think Lemmy is slow/laggy already. With this being a separate site, I can devote 99% of the resources to just scraping the various instances and making the content much easier to search.

Although put this behind a reverse-proxy along side an existing lemmy instance and no one would be the wiser. I'd just need to update it to use the existing database rather than the APIs. ... Some food for thought at least.

Well all of that and convincing the Lemmy team to do the dev work required on their end.

@marsara9 would be cool if it had the ability to search through all instances. don't know if thats possible

Oh wanted to add, as a workaround for now you can set your home instance to lemmy.world or lemmy.ml. Because of how the fediverse works, searching the larger older instances should have a fairly complete copy of content.

Once I do "fix" this though, note that you may click on a link and get a 404 page. As that post may not be on your home instance.

One rule I will always follow for this project is that if I display a link, that link MUST take you to your home instance and that link MUST point to the post in question (but I cannot guarantee that you won't get an error, just that you won't be taken to a completely different post)

@marsara9
I see. Will just set home to the same as the one I search. I'm using Friendica so I'm used to copy links to the search field in order to fetch remote Lemmy posts.

Eventually. I'm waiting on a bug in Lemmy itself to be fixed. Mainly once I can post a link to a post here and anyone can click on it without leaving their home instance.

The results are different depending on which preferred instance I select. Is that the correct behavior?

Correct. As I can only provide links to posts that are on your selected home instance. Eventually I'll change this but you'll get a 404 page for links that aren't on your home instance, but see my P.S. below.

P.s. there have been changes to the Lemmy API that have prevented me from getting updates for about a month now. So most of the results you're seeing are from old posts only. Until I can rebuild the crawler or find a new API there won't be any new content.

This is amazing, nice work! My only criticism at the moment is that on the search results page, the input becomes so squashed that it becomes pointless to use and I’ve gone back to the main screen to redo searches. Giving it its own row, and the search button and drop down their own. should fix that easily.

Thanks for the input. I don't have a lot of experience working on HTML/Javascript, but I'm sure it won't be hard to fix.

I should have uploaded a new version that might be easier to use for you. Can you let me know if that's any better? (you may need to clear your browser cache)

This works great now, thanks for the update!

Can we only search by title with this? I'm getting a lot of unrelated results.

It searches the title and body. It also automatically searches for similar words like. Like 'bike', 'biking', 'bikes' (aka stemming). Granted though, I'm still improving the page ranking as time goes on.

is this a crawler or does it index via mass federation? Or is it using API calls?

API calls. Primarily it just uses /api/v3/post/list.

Funny enough though, one of my first versions I tried to use mass federation, but ran into technical issues.

mass federation is probably not good for the health of the fediverse anyways lol

Why the choice for a .com domain? Is this a commercial project?

just cheaper to get a .com than most of the other TLDs. Especially since I already have a registrar that I'm using for other sites.

.net should be similarly priced at most registrars

Com is not used for commercial anymore. It's basically the "default" TLD.