There is a document in doc or docx format.

There is a template for this document.

It is converted to xml format.

It is necessary to put this xml file in the database. So that later it was possible to adjust the search for some keywords, indexes, for example, and so on.

Interested in articles, examples, guides just such a database.

    1 answer 1

    There is an xml data type in PgSQL, but if you need to search later on this field - it will not work (the xml type does not participate in the expression of the selection conditions).

    The situation with JSON data is much more interesting - then you can do many useful things with data, tricky requests to build, etc. - detailed examples are given in the dock. Therefore, consider the option of converting XML to JSON before saving.

    If JSON is not suitable for some reasons (for example, XML is not always possible to convert losslessly to JSON), then just save it in the text field, create an index like GIN or GIST, and you can build a-full-text search conditions (including combining with normal conditions and join). All this is also described in detail in the documentation . If there are questions after reading the documentation, they could not understand something, etc., then formulate those questions specifically .