CenterForOpenScience / SHARE

SHARE is building a free, open, data set about research and scholarly activities across their life cycle.
http://share-research.readthedocs.io/en/latest/index.html
Apache License 2.0
100 stars 58 forks source link

[SHARE-1000][Feature] Add lineage to works in the search index #723

Closed aaxelb closed 6 years ago

aaxelb commented 6 years ago

Look at a work's IsPartOf relationship as its parent work, and include the closest three ancestors in elasticsearch at lists.lineage.

Given several works with lineage:

Deeply > Nested > Components > To > Make > A > Good > Long > Lineage

The "Long" work will be indexed with:

"lineage": [
    {   
        "identifiers": [
            "urn://share/io.osf:83u96",
            "http://staging-api.osf.io/v2/nodes/83u96/",
            "http://staging.osf.io/83u96/"
        ],  
        "type": "project",
        "title": "Make",
        "types": [
            "project",
            "publication",
            "creative work"
        ],  
        "id": "3314A-94F-6B8"
    },  
    {   
        "identifiers": [
            "urn://share/io.osf:3zmxy",
            "http://staging-api.osf.io/v2/nodes/3zmxy/",
            "http://staging.osf.io/3zmxy/"
        ],  
        "type": "project",
        "title": "A",
        "types": [
            "project",
            "publication",
            "creative work"
        ],  
        "id": "3306B-E73-7C9"
    },  
    {   
        "identifiers": [
            "urn://share/io.osf:ay67d",
            "http://staging-api.osf.io/v2/nodes/ay67d/",
            "http://staging.osf.io/ay67d/"
        ],  
        "type": "project",
        "title": "Good",
        "types": [
            "project",
            "publication",
            "creative work"
        ],  
        "id": "3322F-F86-A2F"
    }   
]   

Also, tidy up the work fetcher SQL to make it slightly more friendly.

https://openscience.atlassian.net/browse/SHARE-1000