Browse Source

merged master into develop

develop
Paul Masurel 5 years ago
parent
commit
8df2e6d202
3 changed files with 21 additions and 0 deletions
  1. +6
    -0
      AUTHORS
  2. +7
    -0
      LICENSE
  3. +8
    -0
      src/commands/new.rs

+ 6
- 0
AUTHORS View File

@@ -0,0 +1,6 @@
# This is the list of authors of tantivy for copyright purposes.
Paul Masurel
# As an employee of Google I am required to add Google LLC
# in the list of authors, but this project is not affiliated to Google
# in any other way.
Google LLC

+ 7
- 0
LICENSE View File

@@ -0,0 +1,7 @@
Copyright (c) 2018 by the project authors, as listed in the AUTHORS file.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 8
- 0
src/commands/new.rs View File

@@ -10,6 +10,8 @@ use tantivy;
use tantivy::schema::Cardinality;
use tantivy::schema::*;
use tantivy::Index;
use std::fs;


pub fn run_new_cli(matches: &ArgMatches) -> Result<(), String> {
let index_directory = PathBuf::from(matches.value_of("index").unwrap());
@@ -152,6 +154,12 @@ fn run_new(directory: PathBuf) -> tantivy::Result<()> {
let schema = schema_builder.build();
let schema_json = format!("{}", serde_json::to_string_pretty(&schema).unwrap());
println!("\n{}\n", Style::new().fg(Green).paint(schema_json));
match fs::create_dir(&directory) {
Ok(_) => (),
// Proceed here; actual existence of index is checked in Index::create_in_dir
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => (),
Err(e) => panic!("{:?}", e),
};
Index::create_in_dir(&directory, schema)?;
Ok(())
}

Loading…
Cancel
Save