swamp icon indicating copy to clipboard operation
swamp copied to clipboard

search via swp cli not working, even after adding a repo was confirmed.

Open gedw99 opened this issue 5 years ago • 3 comments

I get "Returns: "swamp CLI doesn't currently support indexing repositories. Run the swamp app first..""

Looks like its failing here in that it cant find the repo that was added in Step 1 ? https://github.com/swampapp/swamp/blob/master/cmd/swp/main.go#L215

reproduction:

# Step 1: add a restic repo 
swp add-repo --preferred ./swamp/_data/restic-repo
Repository Name: test
✔ Local/Rest
✔ Repository URI:  ./swamp/_data/restic-repo
Repository Password: *
Testing repository access...✅
Added!
Now you should open swamp, select the repository and manually index it.


# Step 2: search therestic repo 
swp search --repo ./swamp/_data/restic-repo 

🛑 swamp CLI doesn't currently support indexing repositories.
Run the swamp app first..

gedw99 avatar Mar 04 '21 15:03 gedw99

seems it records the added repo here: https://github.com/swampapp/swamp/blob/master/internal/paths/paths.go#L11

No sign of the repo being added though

Mine is:

ls -al  /Users/apple/.local/share/com.github.swampapp
total 0
drwxr-xr-x   3 apple  staff   96  4 Mar 16:04 .
drwxr-xr-x  12 apple  staff  384  4 Mar 15:12 ..
drwxr-xr-x   3 apple  staff   96  4 Mar 15:12 logs

log:


{"level":"info","time":"2021-03-04T15:12:31+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"info","time":"2021-03-04T15:13:21+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"warn","time":"2021-03-04T15:16:47+01:00","message":"socket file found in /Users/apple/.local/share/com.github.swampapp/indexing.sock, but looks stale, removing"}
{"level":"info","time":"2021-03-04T15:16:47+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"info","time":"2021-03-04T15:18:25+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"info","time":"2021-03-04T15:25:50+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 4 seconds.\n"}
{"level":"warn","time":"2021-03-04T15:27:02+01:00","message":"socket file found in /Users/apple/.local/share/com.github.swampapp/indexing.sock, but looks stale, removing"}
{"level":"warn","time":"2021-03-04T15:27:28+01:00","message":"socket file found in /Users/apple/.local/share/com.github.swampapp/indexing.sock, but looks stale, removing"}
{"level":"info","time":"2021-03-04T15:27:28+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"info","time":"2021-03-04T15:29:06+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"info","time":"2021-03-04T15:29:10+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"info","time":"2021-03-04T15:29:12+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"warn","time":"2021-03-04T15:29:14+01:00","message":"socket file found in /Users/apple/.local/share/com.github.swampapp/indexing.sock, but looks stale, removing"}
{"level":"info","time":"2021-03-04T15:29:14+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"info","time":"2021-03-04T15:29:16+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"warn","time":"2021-03-04T15:29:17+01:00","message":"socket file found in /Users/apple/.local/share/com.github.swampapp/indexing.sock, but looks stale, removing"}
{"level":"info","time":"2021-03-04T15:29:17+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"info","time":"2021-03-04T15:29:19+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"info","time":"2021-03-04T15:29:20+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 0 seconds.\n"}
{"level":"info","time":"2021-03-04T15:53:39+01:00","message":"6 indexed, 23 already present. 16 new snapshots. Took 4 seconds.\n"}
{"level":"info","time":"2021-03-04T16:04:11+01:00","message":"0 indexed, 0 already present. 0 new snapshots. Took 3 seconds.\n"}

gedw99 avatar Mar 04 '21 15:03 gedw99

@gedw99 having a look at this.

rubiojr avatar Aug 31 '21 20:08 rubiojr

There are a couple of issues, mostly related to swp errors and help being a bit confusing currently.

The first one is that you need to use the repository name as the argument to --repo, test in this particular case. So:

swp search --repo test foo

Note: if there's only one repo that will be the default repo, and using --repo isn't required.

The second issue is that you need to open the swamp GUI first to index the repository before being able to search for things. This will be fixed in the near future.

Does that help?

Leaving the issue open so I don't forget about it.

rubiojr avatar Aug 31 '21 20:08 rubiojr