1. A structured document management device comprising: a processor; and a memory that stores instructions that when executed by the processor performs operations, comprising: receiving an input of a structured document having a layered logical structure; storing the structured document; receiving an input of query data; parsing the syntax of the received query data to acquire a parse tree in which the query data is decomposed so as to meet a static single assignment form which is defined such that each variable is assigned exactly once; acquiring a hierarchical condition that the variables of the parse tree need to meet and constraints that include conditions for values of the respective variables, from the parse tree obtained; rewriting the query data in such a form that the structured document is refinable by the constraints, based on the constraints obtained from acquiring the hierarchical condition; and outputting a search result in response to the query data as an input that is rewritten, wherein the acquiring includes acquiring relaxed constraints by relaxing the hierarchical condition under a same element name as the variables so that other variables rather than the variables meet the relaxed hierarchical condition and by adding the relaxed hierarchical condition to the constraints, the element name being a name of a part that constitutes the structured document, and the rewriting includes obtaining, by taking a product between a variable before being rewritten and an element identifier for identifying the part that constitutes the structured document, a same result as the constraints even when the query data is rewritten based on the relaxed constraints.