Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API #1

Open
elegaanz opened this issue Mar 2, 2018 · 7 comments
Open

REST API #1

elegaanz opened this issue Mar 2, 2018 · 7 comments

Comments

@elegaanz
Copy link
Member

elegaanz commented Mar 2, 2018

No description provided.

@stefangrotz
Copy link

+1 a rest API for revo would be very usefull

@elegaanz
Copy link
Member Author

There are three API endpoints that are already implemented:

  • /api/sercxu?demando=XXX to search for a word
  • /api/hazarda to get a random word
  • /api/vorto/XXX to get information about a specific word

Unfortunately, the project is no longer available online. However you can relatively easily deploy it yourself (I can give you guidance if you want to setup an instance and don't know where to start). If you really need, I can also deploy it myself.

@stefangrotz
Copy link

stefangrotz commented Nov 21, 2023

Hey, thanks for the response. I would love to test it at least locally. If you give me a few hints I can add a how to to the readme. I never deployed a ruby server, how do I start?

Is this a working website or work in progress?

@stefangrotz
Copy link

stefangrotz commented Nov 21, 2023

Okay I found out how to run a rust project myself. (cargo build & cargo run)

I get an error in index.rs on line 13

13: let paths = std::fs::read_dir("articles").unwrap();

Do I have to download the articles first? Where exactly should this directory be?

@elegaanz
Copy link
Member Author

elegaanz commented Nov 22, 2023

You can download articles from the original revo using the crawler.

git clone https://github.com/nova-reta-vortaro/nrv-crawler
cd nrv-crawler
yarn
mkdir articles
node . libro # if you want to import "libro" and related words, for instance
# once you imported all your articles, copy them where NRV expects them
cp -r articles ../nrv # you can probably make a symlink too
cd ../nrv
cargo run # it should work :)

The project is not actively maintained anymore (but because you seemed to be interested and because rocket 0.5 was recently released, I decided to update the dependencies and the code a bit yesterday). In the current state, it has all basic functionality you can expect, but I don't think it can be used in a real setting. This project was a way for me to learn Rust a few years ago, and I never really expected it to be a working alternative to the ReVo. However, if you want to improve it and get it to a state where it is working I can give you pointers on what needs to be done.

@stefangrotz
Copy link

stefangrotz commented Nov 22, 2023

Thanks, I will try it later today.

However, if you want to improve it and get it to a state where it is working I can give you pointers on what needs to be done.

Sure go ahead! I would love to update the design of the revo in one way or another and this looks like a good starting point. At least I can update the readme.md file to make it easier for future contributors.

@elegaanz
Copy link
Member Author

Okay, so I can see a few big points that need to be improved (in no particular order):

  • using a proper search index instead of the current naive implementation. A good rust crate for that is tantivy.
  • improve the crawler to be able to get all information from the ReVo. There are many possibilities here:
    • improve the current one (in JS) and output a richer JSON
    • rewrite it entirely in Rust so that NRV is able to read XML files from the ReVo directly, without depending on an external program. It is probably possible to model the XML format used by ReVo using serde (using #[serde(rename = "...")] attributes extensively and writing some docs would probably be a good idea, because from what I remember the XML format is not always so easy to understand)
  • run the crawler in the background at all time to slowly fill the database
  • make it possible to contribute back to the revo fonto from NRV. This will probably need some discussion with the ReVo maintainers. More generally, if you want to work seriously on this project I think getting in touch with them could be a good idea, to see how they feel about this rewrite and how the two projects can co-exist and help each other.

If you are not familiar with Rust, all of this may be a bit hard (and even if you know Rust it is a lot of work), and just getting in touch with the ReVo maintainers to know if they would accept cosmetic improvements on the official website would be a better idea. If all of that is too much and you just want to update the README so that it is easier for others to contribute, your help would still be welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants