A linear matching method for database index files based on discrete mathematics is proposed. Firstly, the relaxation clustering algorithm is adaptively improved. The corresponding Gauss kernel parameters are obtained by using the domain information of data points direction of the cluster load. The cluster minimal circumscribed matrix is set up according to the calculated coordinate component value, and the optimal cluster is obtained. Electronic dictionary is used to calculate the semantic association between tags of index files after clustering to obtain the name similarity, the cardinal similarity is obtained according to the cardinal constraints, the context similarity is calculated through the path between leaf node and root node, the matched descendant node is queried by the neighbor of non-leaf node, and the descendant node is queried. The number of leaf nodes and their similarity to the original node are calculated for different paths to complete the matching of database index files. The experimental results show that the average energy consumption of matching index files is 439 J and the matching accuracy is 99.72%.