Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Index visible in admin page but not working (following an error in ml-config config) #606

Closed
ltnd opened this issue Apr 28, 2016 · 13 comments

Comments

@ltnd
Copy link

ltnd commented Apr 28, 2016

A bad copy/paste in the XML ml-config file (see example below : inside a ) before applying it has been applied without any error during bootstrap.
Example :

<fields>
        <field>
          <field-name>Test</field-name>
          <field-path>
            <path>/root/val</path>
          </field-path>
        </field>
        <field>
          <field-name>Test2</field-name>
          <field-path>
            <path>/root/val2</path>
          </field-path>
        </field>
      </fields>
      <range-field-indexes>
        <range-field-index>
          <scalar-type>string</scalar-type>
          <field-name>Test</field-name>
          <collation>http://marklogic.com/collation/</collation>
          <range-value-positions>false</range-value-positions>

          <range-field-index>
          <scalar-type>string</scalar-type>
          <field-name>Test2</field-name>
          <collation>http://marklogic.com/collation/</collation>
          <range-value-positions>false</range-value-positions>
        </range-field-index>

        </range-field-index>
      </range-field-indexes>

the "Test" field is created with its index (it's visible in the admin 8001) but impossible to query (XDMP-FIELDRIDXNOTFOUND: cts.fieldReference("Test") -- No field range index for Test http://marklogic.com/collation/ )

Note: the same config file is rejected with ML configuration manager.

@dmcassel
Copy link
Collaborator

There's certainly a bug here, in that the XML structure wasn't validated. To fix your immediate problem, try removing that section from your ml-config.xml, bootstrapping, then putting in the two range indexes properly and bootstrapping again.

@dmcassel
Copy link
Collaborator

Side note: if we implement #598 that should take care of this kind of problem.

@RobertSzkutak
Copy link
Contributor

RobertSzkutak commented Apr 28, 2016

I'm not convinced you're getting the error for the reason you're thinking. When you create indexes they're not immediately available. My guess would be that you're querying the index before it's ready. You can check the database status in the admin console to see whether the database is indexing or not to get an idea of when it will be ready. Even though your XML is "bad" it's still valid XML and as far as I can tell Roxy will ignore the second range-field-index node.

@ltnd
Copy link
Author

ltnd commented Apr 28, 2016

Robert : no, I had only 2 documents in the database and the reindexing was finished.
And the range index worked when I remove the xml part for index Test2.
Roxy does not ignore the XML : it copies it directly on the config and you retrieve the error on the /manage/v2/databases/{name}?format=xml&view=package page.

@RobertSzkutak
Copy link
Contributor

Great, thanks! Perhaps we need to open a bug in ML as well.

@ltnd
Copy link
Author

ltnd commented Apr 28, 2016

I already open it yesterday (#39494) but it was rejected because it's not possible using the "standard way". So I suppose this is the way roxy overwrites directly the config which cause this issue (??)

@RobertSzkutak
Copy link
Contributor

RobertSzkutak commented Apr 28, 2016

I left some intel on your bug including an easily reproducible example of how Roxy would run the query. Hopefully that will make some headway.

@ltnd
Copy link
Author

ltnd commented Apr 28, 2016

Thanks !

@RobertSzkutak
Copy link
Contributor

Engineering's recommendation is that we should use admin:database-range-field-index() to construct the XML rather then trusting our users to handcraft it and pass it in directly admin:database-add-range-field-index() .

How do you feel about that @dmcassel ?

@dmcassel
Copy link
Collaborator

There needs to be some way for users to specify an index. The problem is then validating that it was done correctly, and that isn't happening at the moment. I think the long-term solution to this is #598.

@grtjn
Copy link
Contributor

grtjn commented Jun 3, 2016

I think #598 is more like a future plan for Roxy, but the real fix is like @RobertSzkutak suggests: using admin index functions instead of passing through XML literally. We fixed that on a number of places, but not everywhere yet. See also #492..

@grtjn
Copy link
Contributor

grtjn commented Jun 3, 2016

PR welcome!

@RobertSzkutak RobertSzkutak added this to the 1.7.5 milestone Oct 25, 2016
@RobertSzkutak RobertSzkutak self-assigned this Oct 25, 2016
@RobertSzkutak
Copy link
Contributor

@dmcassel fixed this in #719

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants