Аннотация:The paper discusses the so-called “bag problem,” which affects the search accuracy in the Russian National Corpus (RNC). Solving the problem requires a change of the search index data scheme used in RNC, which in its turn requires a significant refactoring of the RNC program code. The basis of such a refactoring is proposed to be an abstract model of the search index query, which allows us to separate the query formation from the query implementation. An experiment was carried out in which one of the RNC system program modules was decomposed, which confirmed sufficient expressiveness of the constructed model. Directions of further work are determined.