Make plm search use cwd if no directory is given and update doc
This commit is contained in:
parent
ed71d24fe9
commit
24071a6229
48
docs/CLI.md
48
docs/CLI.md
|
@ -49,3 +49,51 @@ plm users new --admin -n 'kate' -N 'Kate' --bio "I'm Kate." --email 'kate@plu.me
|
||||||
- `--email`, `-e`: the email adress of the user.
|
- `--email`, `-e`: the email adress of the user.
|
||||||
- `--password`, `-p`: the password of the user. You probably want to use this option in shell scipts only, since if you don't specify it, the prompt won't show your password.
|
- `--password`, `-p`: the password of the user. You probably want to use this option in shell scipts only, since if you don't specify it, the prompt won't show your password.
|
||||||
- `--admin`, `-a`: makes the user an admin of the instance. Optional, off by default.
|
- `--admin`, `-a`: makes the user an admin of the instance. Optional, off by default.
|
||||||
|
|
||||||
|
## `plm search`
|
||||||
|
|
||||||
|
Manage full text search index.
|
||||||
|
|
||||||
|
### `plm search init`
|
||||||
|
|
||||||
|
Initialize the search index.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
plm search init -p Plume'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Arguments:**
|
||||||
|
|
||||||
|
- `--path`, `-n`: path to plume working directory.
|
||||||
|
- `--force`, `-f`: override any already existing search index.
|
||||||
|
|
||||||
|
### `plm search refill`
|
||||||
|
|
||||||
|
Refill the search index.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
plm search refill -p Plume'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Arguments:**
|
||||||
|
|
||||||
|
- `--path`, `-n`: path to plume working directory.
|
||||||
|
|
||||||
|
### `plm search unlock`
|
||||||
|
|
||||||
|
Remove lock on the search index, after abnormal termination such as power loss.
|
||||||
|
Only do this if you know no processus is currently using the index.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
plm search unlock -p Plume'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Arguments:**
|
||||||
|
|
||||||
|
- `--path`, `-n`: path to plume working directory.
|
||||||
|
|
|
@ -193,6 +193,12 @@ plm instance new
|
||||||
plm users new --admin
|
plm users new --admin
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You will also need to initialise search index
|
||||||
|
|
||||||
|
```
|
||||||
|
plm search init -p path/to/plume/workingdir
|
||||||
|
```
|
||||||
|
|
||||||
For more information about these commands, and the arguments you can give them, check out [their documentaion](CLI.md).
|
For more information about these commands, and the arguments you can give them, check out [their documentaion](CLI.md).
|
||||||
|
|
||||||
Finally, you can start Plume with:
|
Finally, you can start Plume with:
|
||||||
|
@ -224,6 +230,7 @@ docker-compose run --rm plume diesel database setup
|
||||||
# Setup your instance
|
# Setup your instance
|
||||||
docker-compose run --rm plume plm instance new
|
docker-compose run --rm plume plm instance new
|
||||||
docker-compose run --rm plume plm users new --admin
|
docker-compose run --rm plume plm users new --admin
|
||||||
|
docker-compose run --rm plume plm search init
|
||||||
|
|
||||||
# Launch your instance for good
|
# Launch your instance for good
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub fn command<'a, 'b>() -> App<'a, 'b> {
|
||||||
.short("p")
|
.short("p")
|
||||||
.long("path")
|
.long("path")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.required(true)
|
.required(false)
|
||||||
.help("Path to Plume's working directory"))
|
.help("Path to Plume's working directory"))
|
||||||
.arg(Arg::with_name("force")
|
.arg(Arg::with_name("force")
|
||||||
.short("f")
|
.short("f")
|
||||||
|
@ -31,7 +31,7 @@ pub fn command<'a, 'b>() -> App<'a, 'b> {
|
||||||
.short("p")
|
.short("p")
|
||||||
.long("path")
|
.long("path")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.required(true)
|
.required(false)
|
||||||
.help("Path to Plume's working directory")
|
.help("Path to Plume's working directory")
|
||||||
).about("Regenerate Plume's search index"))
|
).about("Regenerate Plume's search index"))
|
||||||
.subcommand(SubCommand::with_name("unlock")
|
.subcommand(SubCommand::with_name("unlock")
|
||||||
|
@ -39,7 +39,7 @@ pub fn command<'a, 'b>() -> App<'a, 'b> {
|
||||||
.short("p")
|
.short("p")
|
||||||
.long("path")
|
.long("path")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.required(true)
|
.required(false)
|
||||||
.help("Path to Plume's working directory")
|
.help("Path to Plume's working directory")
|
||||||
).about("Release lock on search directory"))
|
).about("Release lock on search directory"))
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ pub fn run<'a>(args: &ArgMatches<'a>, conn: &Connection) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init<'a>(args: &ArgMatches<'a>, conn: &Connection) {
|
fn init<'a>(args: &ArgMatches<'a>, conn: &Connection) {
|
||||||
let path = args.value_of("path").unwrap();
|
let path = args.value_of("path").unwrap_or(".");
|
||||||
let force = args.is_present("force");
|
let force = args.is_present("force");
|
||||||
let path = Path::new(path).join("search_index");
|
let path = Path::new(path).join("search_index");
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ fn init<'a>(args: &ArgMatches<'a>, conn: &Connection) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn refill<'a>(args: &ArgMatches<'a>, conn: &Connection, searcher: Option<Searcher>) {
|
fn refill<'a>(args: &ArgMatches<'a>, conn: &Connection, searcher: Option<Searcher>) {
|
||||||
let path = args.value_of("path").unwrap();
|
let path = args.value_of("path").unwrap_or(".");
|
||||||
let path = Path::new(path).join("search_index");
|
let path = Path::new(path).join("search_index");
|
||||||
let searcher = searcher.unwrap_or_else(|| Searcher::open(&path).unwrap());
|
let searcher = searcher.unwrap_or_else(|| Searcher::open(&path).unwrap());
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ fn refill<'a>(args: &ArgMatches<'a>, conn: &Connection, searcher: Option<Searche
|
||||||
|
|
||||||
|
|
||||||
fn unlock<'a>(args: &ArgMatches<'a>) {
|
fn unlock<'a>(args: &ArgMatches<'a>) {
|
||||||
let path = args.value_of("path").unwrap();
|
let path = args.value_of("path").unwrap_or(".");
|
||||||
let path = Path::new(path).join("search_index/.tantivy-indexer.lock");
|
let path = Path::new(path).join("search_index/.tantivy-indexer.lock");
|
||||||
|
|
||||||
remove_file(path).unwrap();
|
remove_file(path).unwrap();
|
||||||
|
|
Loading…
Reference in New Issue