Most encoders don't have absolute position encoding. That requires multiple tracks to generate binary (or more likely, gray code, which is designed so only one bit changes at a time, so it is harder to miss something).
Most rotary encoders on spindles have only two tracks -- one has only one hole, to show the index point, and the other has as many holes as needed for the resolution. If you are counting pulses, reset to zero every time the index passes. Yes, I have some encoders which give binary data, but they are a bit fragile to use on a machine tool, and in particular, they depend on a single long filament lamp to illuminate all the tracks and sensors. Those lamps are made of unobtanium, so if you design and build a tool using one, and the lamp dies, you have to re-do the design. (Yes, you probably could do it using LEDs instead of a lamp, but still getting that narrow line of illumination will be tricky, especially inside the small housing provided.
Better to have the two track encoder (index and count), and set up a quadrature detector, so you can count the counter up or down depending on which direction the spindle moves in at the moment.
Good Luck, DoN.