enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
202 stars 34 forks source link

Make indexed data configurable #4898

Open runarmyklebust opened 7 years ago

runarmyklebust commented 7 years ago

Challenges:

1) Customers wants to do index things that are outside the content-data in the content-domain, e.g "x.com-enonic-app-metafields.meta-data.seoDescription" for Posten. 2) Todays storing of index-config on the node/content level means that a) We need upgrade models to change this config (modify every document in repo) b) Every data-instance needs to store, usually very similar, index-config 3) We have no mechanism to store meta-data that dont really belongs to the content itself. It can be done manually by adding separate fields, but then values must be specified and stored in each document.

Configure what to be indexed (1)

Some is already available through the indexConfigDocument, its not possible to modify in the content-domain though.

Storing (2)

Its clean that we cant store this on every single node, so we need to fetch this another way when indexing the node.

For content, this could be achieved by populating from content-type definition. If no definition, use default config. This should be translated into NodeIndexConfig provided when storing node (like todays IndexConfigDocument)? Should default config be configurable? By e.g com.enonic.xp.index.mapping.

A challenge by this is when doing reindex and other operations on node-level; the index domain stuff is not available from the node domain.

For nodes, this must be stored elsewhere; _nodeType property for deciding type and application provided mappingfiles.

ContentType vs NodeType

Pros

Cons

NodeType Object

Search meta-data

e.g

{
  "_search": {
    "meta": {
      "description": "some description",
      "tags": [
        "fisk",
        "ost",
        "løk"
      ]
    },
    "virtualFields": {
      "allProductText": [
        "data.productName",
        "data.productDescr"
      ]
    }
  }
}
ComLock commented 7 years ago

To use the seo app data in queries, fulltext and ngram must be enabled for x-data. This has become rather important for a customer. Since it's not an "incident" we have not filed a support request for it.

ComLock commented 7 years ago

Another pro for node-types is the possibility of generating GraphQL schemas.