Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OneMore 'tag search' finds a fraction of tag cases #1695

Open
hollowheights opened this issue Dec 4, 2024 · 9 comments
Open

OneMore 'tag search' finds a fraction of tag cases #1695

hollowheights opened this issue Dec 4, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@hollowheights
Copy link

Problem to Solve

Searches for my tags will bring up only a fraction of the notes that include any given tag. There is no apparent pattern, it finds both recent and older notes, and notes from several sections within the specified notebook.

The tags used are simple, one example being: #no_fill
That tag is on at least 10 pages, but only 3 pages show up in the search. Last scan is up to date.

To Reproduce

[Can't say if this will reproduce on other machines]

Steps to reproduce the behavior:
-Search for any given standard tag
-See that not all are shown

Expected Behavior

I expected all cases of any specified tag (within the relevant notebook) to show up in the search list.

Environment (if applicable)

  • OneNote Version: Version 2410
  • OneMore Version: Version 6.5.2 with OneNote 16.0.18129.20158

Additional Context

Sorry if this is a simple mistake on my part, but I don't see anything that could explain this

@hollowheights hollowheights added bug Something isn't working unread I have seen it or had time to refine it yet labels Dec 4, 2024
@hollowheights hollowheights closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2024
@hollowheights hollowheights reopened this Dec 4, 2024
@stevencohn
Copy link
Owner

The algorithm is based on last update timestamp on each page. It will only look at a page if it has been modified or edited in any way since the previous hashtag scan. Once the scan completes, it records the current time so it can compare that with pages edited later on. On the very first scan, it assumes every page has been edited so should scan them all.

It stores hashtag info in the database file %appdata%\OneMore\OneMore.db. At the moment, only hashtag info is stored in that database. So you could close OneNote, delete this file, and then reopen OneNote. OneMore should start a brand new scan and find all tags.

I'm guessing there was some weird order of operations that caused the timestamp algorithm to get confused and think some pages were not modified.

@stevencohn stevencohn removed the unread I have seen it or had time to refine it yet label Dec 5, 2024
@jasonjac2
Copy link

So is the update stamp independent on each PC? i,.e. if I update on PC1 and it doesn't sync to PC 2 for 20 seconds, what is the "last updated" PC1 time or PC2 time or is it all based on the hosted server?

If there is any doubt, maybe you should have a LastScanStarted -x seconds in the settings (x = 0 - 300) and do a slow (very few pages per normal scan) "do everything" march back in time to catch all.

It's weird, there are 4 of us using shared ON's and I am sometimes tags are missed, but I can't be completely convinced. When you scan a page, do you update the "last checked" in your OneMoreDB for that page?

@stevencohn
Copy link
Owner

stevencohn commented Dec 5, 2024

@jasonjac2 Each PC is independent with its own DB and LastScanTime. There is one LastScanTime recorded on each PC when the scanner runs on that PC. Each page has its own last-updated time, recorded by OneNote; the OneMore scanner relies on this.

Each PC runs its own scan, relying on its own copy of the LastScanTime. Even if two PCs scan at the same time, they will both see recently updated pages (for those shared across OneDrive of course). Even if the page is updated in between PC1 scan and PC2 scan, both will ultimately pick up changes at their next local scan.

EDIT: It writes the LastScanTime at the end of the scan. It could be improved to record the start of the scan instead... thinking....

@hollowheights
Copy link
Author

Hi @stevencohn
Thanks for the explanation, much appreciated!
I tried that, and it worked immediately. I've been modifying the sharts on each page on a running basing, and indeed somehow that hasn't triggered the algorithm. I had also tried having both OneNote restarted and disabled and (re)enabled the OneMore plugin.

@jasonjac2
Copy link

@stevencohn thanks for the explanation. I see the started scan as much safer, but my issue is really with the definition of ON's last modified..... if it comes from the source of the modification (some other machine) or the mother storage (OneDrive / Sharepoint), it could still be seconds or minutes before when you started the scan.

  1. You start your scan; query ON; get the pages to review
  2. you finish you scan
  3. ON's lazy sync realises that a page was updated ages ago on another machine
    4)that page gets sync'd to this machine.
  4. that page on this machine does it have the time it was sync'd as the modified OR the time the originator made the change?

I am a little worried it would the the originators time (which may be seconds or minutes after your scan started or finished.

@stevencohn
Copy link
Owner

I double-checked the algorithm. Turns out that it is correct! When the scanner is instantiated, before it starts scanning, it records the current time in a variable. When it's done, it records the value in that variable in the database as the latest LastScanTime. So there is no gap.

@jasonjac2 As far as I can tell, the client machine is responsible for setting the last-modified timestamp on a page. If the clocks on two machines are drastically off, then a page's last-modified timestamp may be missed by late machine. But if you're using a modern version of Windows, they should sync with time.windows.com.

@jasonjac2
Copy link

LAst scan = start of last scan -excellent.

Sorry for labouring the discussion, but to be clear then. Once the dust settles, each machine will have different "last modified" for the same page? Assuming it takes at least a second from change to sync from source machine to cloud and then to sync with "client"?
If that is the case, then that's fine.

On the other hand - If the source client sets the modified, then assuming that MS is having a bad day OR you are on a crappy set up OR you lose connection (on a train plan or automobile), then you end up with "cracks".

I'll do an experiment today.

@hollowheights
Copy link
Author

Since the solution suggested solved the issue, I've run into a new problem.
Some of the search results can't open: "Cannot navigate to this page. (...)".
This seems to have been caused by a name-change for some of the sections in the notebook.
Is it expected that any such change will require a delete of the OneMore.db file?

@stevencohn
Copy link
Owner

Deleting the db is the nuclear option.
I tried this myself, adding hashtags, renaming the section, searching for the tags. Seems to work in all cases I can think of.

Any other steps to reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants