this post was submitted on 20 Aug 2024
13 points (100.0% liked)

Selfhosted

40006 readers
874 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

I have a php webpage with a search bar that uses php code to search my server for files. It's really slow. It's a custom made thing I came up with years ago.

Are there any standalone python or c++ projects or libraries I can use that handle file searching? Plugging in a more optimal search function into this system would be a massive improvement but I can't really replace this with a different system because reasons. If the only way to get such a feature is if I program it myself, then I'll have to do that as it will be less work than migrating to a new system. But I'm pretty sure there exists something I could use to manage the search so I can shoehorn that in to the codebase instead of starting from scratch. Any suggestions?

Tl;dr I'm looking for a command line search program that runs on Linux and has some form of indexing.

top 6 comments
sorted by: hot top controversial new old
[–] [email protected] 12 points 2 months ago

Do you need more than locate offers?

https://wiki.archlinux.org/title/Locate

[–] [email protected] 2 points 2 months ago

I guess it depends on scale.

  • FSearch

  • Recoll

  • TypeSense

[–] [email protected] 2 points 2 months ago
[–] [email protected] 2 points 2 months ago

What about simply shelling out to ripgrep?

[–] [email protected] 1 points 2 months ago

Something that uses Xapian as the back end, maybe?

There's more than a few options or you could roll your own.

[–] [email protected] 1 points 2 months ago

Do you need to search inside of files for text, or just file names?

If inside of files, something simple like ripgrep/ag/grep like someone else mentioned would be an easy option.

If just file names, why not create an index of filenames and search that instead?

If you need an advanced search, maybe ElasticSearch would work for you? You'd have to upload each file to the elasticsearch server though.