toml
[dependencies]
heliotrope = "*"
bash
git clone https://github.com/Valve/heliotrope
cd heliotrope
cargo run --example hello
Add dependency to your project by Cargo.toml
toml
[dependencies]
heliotrope = "*"
```rust extern crate heliotrope; extern crate url;
use heliotrope::{Solr, SolrDocument, SolrQuery}; use url::Url;
fn main(){ let baseurl = "http://localhost:8983/solr/test/"; let url: Url = Url::parse(baseurl).unwrap(); let client = Solr::new(&url);
let doc = SolrDocument::new();
doc.add_field("id", "1");
doc.add_field("city", "London");
client.add_and_commit(&doc);
let query_all = SolrQuery::new("*:*");
let results = client.query(&query_all);
if let Ok(resp) = results {
println!("Retreived results {:?}", resp);
}
} ```
Copyright 2015 Valentin Vasilyev, Dzmitry Misiuk
Licensed under the Apache License, Version 2.0