You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Restrict occ index command to specific folder #184
Love the Memories app. Set it up, indexed my instance and set my directory path, but for some reason, if I add new pictures to my photo collection (which is on an external drive) they don't show up in the Memories app. I tried running the index again, but I have since added several more drives and the index command wants to scan everything. I haven't been able to successfully scan the instance again, but also don't want to.
Do I have to index each time, and if so, is there a way to restrict it to just my photo collection?
Turned out I needed to add the .nomedia to a few more folders. Thanks. Followup question. Do I always have to do the scan command or is there a way to add photos to the nextcloud instance and not have to run the command to have them show up in Memories.
In general, you should never need to re run the command except:
1/ When you upgrade (and the changelog indicates you need to)
2/ When you change nomedia files and you care about the folders shown (for now, at least)
Is there anything you're trying to achieve other than reduce initial indexing time? Indexing everything shouldn't have any impact on performance. As long as you set your timeline path to the directory with your photos, it should be fine.
Other interesting point: database can be a bit lighter when not containing uninteresting files. On my setup, I have 68k records, and an quick estimate of 10% (6k) are irrelevant.
Other interesting point: database can be a bit lighter when not containing uninteresting files. On my setup, I have 68k records, and an quick estimate of 10% (6k) are irrelevant.
I can't imagine that being more than a few megabytes of storage extra. As I mentioned, this shouldn't have an impact on performance.
The "index all, show some" behavior (#22 (comment)) has a major problem.
My situation: I have about 400k files and 90% of them are in S3 Glacier Instant Retrieval, which means that they are meant to be sleeping there and it's expensive to access them. The normal pattern is that old files are not accessed often (less than 0.05% each day).
I could spread .nomedia files across my directories, but I can't control other users directories.
I think the index command should only act on the directories that are configured as memories root for each user or, as @terencedesu suggested, have a parameter to configure where the index process should start.
Another idea is a parameter to limit the amount of files to index for a single run, so I can control how many files will be indexed per day and plan the indexing costs through time.
Later I'll browse through the code to see how the index is done. Is there a technical limitation to a partial index?
I think the index command should only act on the directories that are configured as memories root for each user or, as @terencedesu suggested, have a parameter to configure where the index process should start.
We can't scan the timeline folder selectively because in typical usage the indexing is done before the timeline folder is selected, plus the timeline folder may change. But having a parameter for the directory path to scan is a fair idea.
I want to note that this still doesn't work if you have absolutely no control over how users store data. At the minimum, you still do need to tell users to place their photos in a certain directory.
Another idea is a parameter to limit the amount of files to index for a single run, so I can control how many files will be indexed per day and plan the indexing costs through time.
I'd be wary of this on a production system; users would see half their library of photos and think something went wrong.
Later I'll browse through the code to see how the index is done. Is there a technical limitation to a partial index?
No limitation other than what's already mentioned. I'm open to a PR implementing indexing only a fixed path, provided as a system-wide config option (we need this to restrict scanning for future uploads in PostWriteListener).
At the minimum, you still do need to tell users to place their photos in a certain directory.
That's the idea, I'll announce to the users (basically family and some friends) which path they must use to have their files indexed.
Another idea is a parameter to limit the amount of files to index for a single run, so I can control how many files will be indexed per day and plan the indexing costs through time.
I'd be wary of this on a production system; users would see half their library of photos and think something went wrong.
This could lead to undesirable side effects, for sure...
I'm open to a PR implementing indexing only a fixed path, provided as a system-wide config option (we need this to restrict scanning for future uploads in PostWriteListener).
I'd also be interested in this. I only have like 4 folders with pictures, but occ memories:index is indexing all the files in the filesystem and it's quite slow. At the moment the process has been running for 11 days, and it's still at the 19.4%, so I can expect the whole indexing process to take around two months.
I'd rather not fill my directories with .nomedia files. So, the same way occ files:scan has the --path parameter, it would be great if memories would have something similar, so I could just schedule a scan for these 4 dirs with photos.
I have one other use case (although I'm not sure I'd actually use this feature, so take this with a grain of salt). My pictures are organized by years (2023, 2022, 2021...going back 20 years). So I don't really need to be re-indexing anything but the current year most times. If I could limit it, I might update the job at the beginning of every year to only scan the current year. My indexing runs fast enough that that I'm not sure the reduced runtime would matter, and I don't have any other files that aren't part of my picture collection.
@rhatguy you shouldn't be needing to re-index at all. Are you uploading files from outside Nextcloud? As long as you use Nextcloud to upload it will automatically trigger hooks to index the new file.
@pulsejet One question. I keep my pictures (all my data, actually) in external storage, and once a day I make sure it's sync'd with nextcloud (using occ files:scan, which takes about half an hour), since the files can be modified inside or outside nextcloud.
So when Nextcloud finds these new pictures with each daily scan, will the hooks be triggered to index the new pictures in memories or I have to run occ memories:index again?
@wonx no, scan doesn't trigger hooks, so you'll need to run occ memories:index again in this case.
But this should be (very) fast: memories doesn't index anything that hasn't changed by checking the modification timestamp. Your subsequent runs should basically skip over all unchanged files.
Another idea:
I restricted the app to a specific user or group via the app admin panel. I would expect that the indexing will not be done for users or groups that are not named here. It still scans for files of all users.
Alternatively, there could be an option to only scan a specific user: occ memories:index -f [specific_username]
Maybe that helps and hopefully would be easy to implement.
Even more, maybe it makes sense to limit indexing to the folders namen in the settings part of memories? It would not be helpful to have to rerun indexing once someone is changing the folder though. Just another idea.
Activity
pulsejet commentedon Nov 11, 2022
Ideally you should be adding
.nomediato the folders whose trees you don't want to index.terencedesu commentedon Nov 11, 2022
Thanks for the quick response. I thought I had done that for the drives I didn't want to index but maybe I missed it. I'll give it a shot.
terencedesu commentedon Nov 12, 2022
Turned out I needed to add the .nomedia to a few more folders. Thanks. Followup question. Do I always have to do the scan command or is there a way to add photos to the nextcloud instance and not have to run the command to have them show up in Memories.
pulsejet commentedon Nov 12, 2022
In general, you should never need to re run the command except:
1/ When you upgrade (and the changelog indicates you need to)
2/ When you change nomedia files and you care about the folders shown (for now, at least)
Glandos commentedon Nov 15, 2022
That's one mechanism. But on my Nextcloud storage I have:
I need to put a
.nomediaeverywhere else? This would cripple my own computer's directories synchronized with Nextcloud 😞pulsejet commentedon Nov 15, 2022
Is there anything you're trying to achieve other than reduce initial indexing time? Indexing everything shouldn't have any impact on performance. As long as you set your timeline path to the directory with your photos, it should be fine.
Glandos commentedon Nov 15, 2022
You're right, it's not that important.
Other interesting point: database can be a bit lighter when not containing uninteresting files. On my setup, I have 68k records, and an quick estimate of 10% (6k) are irrelevant.
pulsejet commentedon Nov 15, 2022
I can't imagine that being more than a few megabytes of storage extra. As I mentioned, this shouldn't have an impact on performance.
vinisxs commentedon Nov 30, 2022
The "index all, show some" behavior (#22 (comment)) has a major problem.
My situation: I have about 400k files and 90% of them are in S3 Glacier Instant Retrieval, which means that they are meant to be sleeping there and it's expensive to access them. The normal pattern is that old files are not accessed often (less than 0.05% each day).
I could spread .nomedia files across my directories, but I can't control other users directories.
pulsejet commentedon Nov 30, 2022
@vipseixas what behavior do you suggest then? I'm not sure what makes sense if you don't have control over how users store files / photos.
vinisxs commentedon Nov 30, 2022
I think the index command should only act on the directories that are configured as memories root for each user or, as @terencedesu suggested, have a parameter to configure where the index process should start.
Another idea is a parameter to limit the amount of files to index for a single run, so I can control how many files will be indexed per day and plan the indexing costs through time.
Later I'll browse through the code to see how the index is done. Is there a technical limitation to a partial index?
pulsejet commentedon Nov 30, 2022
We can't scan the timeline folder selectively because in typical usage the indexing is done before the timeline folder is selected, plus the timeline folder may change. But having a parameter for the directory path to scan is a fair idea.
I want to note that this still doesn't work if you have absolutely no control over how users store data. At the minimum, you still do need to tell users to place their photos in a certain directory.
I'd be wary of this on a production system; users would see half their library of photos and think something went wrong.
No limitation other than what's already mentioned. I'm open to a PR implementing indexing only a fixed path, provided as a system-wide config option (we need this to restrict scanning for future uploads in
PostWriteListener).vinisxs commentedon Nov 30, 2022
That's the idea, I'll announce to the users (basically family and some friends) which path they must use to have their files indexed.
This could lead to undesirable side effects, for sure...
Great, I'll test this as soon it's done. Thanks!
wonx commentedon Feb 24, 2023
I'd also be interested in this. I only have like 4 folders with pictures, but
occ memories:indexis indexing all the files in the filesystem and it's quite slow. At the moment the process has been running for 11 days, and it's still at the 19.4%, so I can expect the whole indexing process to take around two months.I'd rather not fill my directories with
.nomediafiles. So, the same wayocc files:scanhas the--pathparameter, it would be great if memories would have something similar, so I could just schedule a scan for these 4 dirs with photos.rhatguy commentedon Feb 24, 2023
I have one other use case (although I'm not sure I'd actually use this feature, so take this with a grain of salt). My pictures are organized by years (2023, 2022, 2021...going back 20 years). So I don't really need to be re-indexing anything but the current year most times. If I could limit it, I might update the job at the beginning of every year to only scan the current year. My indexing runs fast enough that that I'm not sure the reduced runtime would matter, and I don't have any other files that aren't part of my picture collection.
pulsejet commentedon Feb 24, 2023
@rhatguy you shouldn't be needing to re-index at all. Are you uploading files from outside Nextcloud? As long as you use Nextcloud to upload it will automatically trigger hooks to index the new file.
wonx commentedon Feb 24, 2023
@pulsejet One question. I keep my pictures (all my data, actually) in external storage, and once a day I make sure it's sync'd with nextcloud (using
occ files:scan, which takes about half an hour), since the files can be modified inside or outside nextcloud.So when Nextcloud finds these new pictures with each daily scan, will the hooks be triggered to index the new pictures in memories or I have to run
occ memories:index again?pulsejet commentedon Feb 24, 2023
@wonx no, scan doesn't trigger hooks, so you'll need to run
occ memories:indexagain in this case.But this should be (very) fast: memories doesn't index anything that hasn't changed by checking the modification timestamp. Your subsequent runs should basically skip over all unchanged files.
khlschrnk commentedon Mar 5, 2023
Another idea:
I restricted the app to a specific user or group via the app admin panel. I would expect that the indexing will not be done for users or groups that are not named here. It still scans for files of all users.
Alternatively, there could be an option to only scan a specific user: occ memories:index -f [specific_username]
Maybe that helps and hopefully would be easy to implement.
khlschrnk commentedon Mar 5, 2023
Even more, maybe it makes sense to limit indexing to the folders namen in the settings part of memories? It would not be helpful to have to rerun indexing once someone is changing the folder though. Just another idea.
index: allow specifying user and folder (fix pulsejet#184)