Word count forgetfulness

The problem: Whenever I launch scrivener and it opens my current project automatically, the project target window will show about 20,000 fewer words than are actually in the files of the binder (roughly 83k as of today). I can find most of them by the icons looking like blank pages in the binder, even though when I select each one of them, the icons change to looking like pages with writing on them, and the word count increases by the number of words in that document.

There are a number of factors that may have originally caused this issue. At around the same two week period I did the following:
Installed drop-box and created a symbolic link in the Drop Box folder to my project bundle/directory.
Had my computer crash and restored from backup 3 times before installing my latest hard drive & duplicating my drive’s contents via SuperDuper before resuming Drop Box syncing.
Installed Drop Box on my computer at work and the last 1.x Beta of Scrivener for Windows, then loaded my project. I only edited one document’s Document Notes, but did click on a number of the documents in my binder (possibly the ones I’m having trouble with).

At this point, I have deleted the symbolic link, so DB is not syncing my project at all at the moment (though I am pointing my backups to the folder).

Console.app shows a few errors for Scrivener from two days ago, but nothing from yesterday when I added to my project, nor anything from today. I’m including them just in case, as there are only a few lines. I’ll be glad to email a zipped copy of my project if you want, but wasn’t going to send it unsolicited.

Thanks in advance for any fixes you can suggest or provide.

(Probably unrelated) Scrivener errors from 2 days ago:
3/14/11 6:32:39 PM Scrivener[18830] _NXGetScreenRect: error getting display bounds (1001)
3/14/11 6:32:39 PM Scrivener[18830] _NXGetScreenRect: error getting display bounds (1001)
3/14/11 6:32:39 PM Scrivener[18830] _NXGetScreenRect: error getting display bounds (1001)
3/14/11 6:32:39 PM Scrivener[18830] _NXGetScreenRect: error getting display bounds (1001)
3/14/11 6:32:39 PM Scrivener[18830] _NXGetScreenRect: error getting display bounds (1001)
3/14/11 6:32:39 PM Scrivener[18830] _NXGetScreenRect: error getting display bounds (1001)
3/14/11 8:34:53 PM Scrivener[18830] CFUserNotificationDisplayAlert: called from main application thread, will block waiting for a response.
3/14/11 8:36:53 PM Scrivener[18830] [QL] Asking to compute a thumbnail in main thread is potentially blocking the user interface
3/14/11 8:36:54 PM Scrivener[18830] [QL] Asking to compute a thumbnail in main thread is potentially blocking the user interface
3/14/11 8:36:56 PM Scrivener[18830] [QL] Asking to compute a thumbnail in main thread is potentially blocking the user interface
3/14/11 8:36:56 PM Scrivener[18830] [QL] Asking to compute a thumbnail in main thread is potentially blocking the user interface

There was a bug in earlier Windows betas where the search index was not being correctly updated, and the symptom of this was icons depicting a blank sheet of paper until you clicked on them. That would be my first suspect, rather than anything Dropbox is doing. It would have to be incorrectly handling the search index (which is possible but not likely) otherwise.

To fix indexing errors (on the Mac), hold down the Option key and select Save and Rebuild Search Indexes from the File menu. That should only take a few seconds, and your icons should all get fixed—and hopefully the word count issue, too.

I had no idea that other menu items lurked behind the option key. I did as you suggested, quit Scrivener because the UI/word counts didn’t update, and the reopened it. Problem solved!

Thanks for the speedy help.

Those other console messages are, I believe, harmless, too. Sometimes on OS X window sizes give weird errors, which is what is happening here, and there’s a QuickLook icon-creation warning that is harmless.

Ioa is spot on about the issue here - it means the search.indexes file isn’t up to date. The internal search.indexes file stores a plain text representation of all of the documents in your project. It is used for searching in the project both by Scrivener and Spotlight, because having a plain text representation of all text in one file makes searching much faster than having Scrivener or Spotlight try to open every single RTF file of disk while running a search. But it is also used to determine whether an icon needs to show text in it - because again, it’s quicker, as Scrivener is able to store the search index in memory as the plain text representation is much smaller than the rich text representation of all the files, so Scrivener can just do a quick check in the search indexes: “Yep, that document has text in the indexes, so it should have an icon.” And the search indexes are also used anywhere else where quick access to the text is needed if the RTF file hasn’t been opened and edited in the interface yet - such as in the project targets. To get the word and character count, project targets, like many other places, will get the count from the rich text if it has been opened in the editor at some point during the session (because then it’s already been loaded and so is in memory and just as quick), otherwise it asks for the plain text representation of the text in the search index table and gets the count from that.

Thus, if the search.indexes file hadn’t been saved properly, then you would see all of the behaviour you are describing. Ioa’s already given the fix, but I do still wonder how this was being caused - were you using an earlier beta of of the Windows version still, or could it have been an earlier beta of the Windows version that caused it for this project?

Thanks!
All the best,
Keith

My uneducated guess is that when I opened the project on Scrivener for windows, beta version 1.9 (I think… it definitely wasn’t beta 2.0*), it caused the problem. I opened the project (via Drop Box) on windows, added a line to one document’s Document Notes, and then clicked on a number of other documents in the binder before closing Scrivener. That was the one and only time I loaded the project on the windows beta, but the problem persisted every time I opened the project into the Mac 2.0* version.

By the way, I’ve reproduced this problem with MacScriv 2.0.5 & WinScriv beta 0.2.2. I posted the setup at https://forum.literatureandlatte.com/t/macscriv-dropbox-winscriv-search-index-issue/12320/1

I’ve noticed this as of version 2.0.5 (9496) - I thought it was because I was saving my scrivs to a dropbox folder and opening them on my other mac occasionally, but even if I just close and re-open scrivener, I’m losing my total word count. I can recapture it by going through every scene in the binder (lingering for a second or two on the scene so that scrivener has a chance to pull the number of words), but this is going to get tedious the more I write :slight_smile:

No need for tedium; Amber provided the solution a few comments up. Hold down the Option key, and go to File-> Save and Rebuild Search Indexes in the menu. That will fix the issue, which hasn’t recurred for me since I did that.

Wait - we’re supposed to read other people’s comments??? :blush:

Thanks!!!