The paper introduces a generalized inverted index to enhance keyword search efficiency in large datasets by encoding consecutive document IDs into intervals, thus reducing storage space and improving search performance. This new structure allows for faster keyword search operations through advanced algorithms and document reordering techniques. Experimental results demonstrate that the generalized inverted index outperforms traditional inverted indexes in terms of both storage requirements and keyword search speed.