[ 
https://issues.apache.org/jira/browse/OAK-6471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16099715#comment-16099715
 ] 

Chetan Mehrotra edited comment on OAK-6471 at 7/25/17 8:37 AM:
---------------------------------------------------------------

Following command can now be used to import new index definitions

{noformat}
java -jar oak-run-1.8-SNAPSHOT.jar index --reindex 
--index-paths=/oak:index/barIndex  mongodb://server:27017/oak --read-write=true 
--index-definitions-file=index.json
{noformat}

Where index.json
{code}
{
  "/oak:index/barIndex": {
    "compatVersion": 2,
    "type": "lucene",
    "async": "async",
    "jcr:primaryType": "oak:QueryIndexDefinition",
    "indexRules": {
      "jcr:primaryType": "nt:unstructured",
      "nt:base": {
        "jcr:primaryType": "nt:unstructured",
        "properties": {
          "jcr:primaryType": "nt:unstructured",
          "bar": {
            "name": "bar",
            "propertyIndex": true,
            "jcr:primaryType": "nt:unstructured"
          }
        }
      }
    }
  }
}
{code}

It supports the json generated from http://oakutils.appspot.com/generate/index

Refer to docs for usage 
https://jackrabbit.apache.org/oak/docs/query/oak-run-indexing.html#index-definition-updates



was (Author: chetanm):
Following command can now be used to import new index definitions

{noformat}
java -jar oak-run-1.8-SNAPSHOT.jar index --reindex 
--index-paths=/oak:index/barIndex  mongodb://server:27017/oak --read-write=true 
--index-definitions-file=index.json
{noformat}

Where index.json
{code}
{
  "/oak:index/barIndex": {
    "compatVersion": 2,
    "type": "lucene",
    "async": "async",
    "jcr:primaryType": "oak:QueryIndexDefinition",
    "indexRules": {
      "jcr:primaryType": "nt:unstructured",
      "nt:base": {
        "jcr:primaryType": "nt:unstructured",
        "properties": {
          "jcr:primaryType": "nt:unstructured",
          "bar": {
            "name": "bar",
            "propertyIndex": true,
            "jcr:primaryType": "nt:unstructured"
          }
        }
      }
    }
  }
}
{code}

Refer to docs for usage 
https://jackrabbit.apache.org/oak/docs/query/oak-run-indexing.html#index-definition-updates


> Support adding or updating index definitions via oak-run
> --------------------------------------------------------
>
>                 Key: OAK-6471
>                 URL: https://issues.apache.org/jira/browse/OAK-6471
>             Project: Jackrabbit Oak
>          Issue Type: New Feature
>          Components: indexing, run
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>             Fix For: 1.8
>
>
> Currently oak-run can be used to reindex an existing index present in 
> NodeStore. I would like to extend this feature set to support adding or 
> updating the index definition and then reindexing them. The end user story 
> would be like below
> Development team updates or introduces a new index definition and gives it to 
> system admin. Then admin can use oak-run and give it reference to the index 
> definition and then tooling takes care of indexing (with read only mode) and 
> then importing the updated index definition back into the repository.
> To start with the index definitions would be provided as a json file with a 
> single json file containing index definitions which needs to be reindexed. 
> The file format would be similar to one we used for dumping index definition 
> (OAK-6224). 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to