MarkLogicUniversity / Geophoto

Sample MarkLogic application with binary, JSON, and RDF triple data
MIT License
13 stars 13 forks source link

map feature throws Bad Request 400 with msg SEARCH-BADORDERBY #9

Closed ouyi closed 7 years ago

ouyi commented 8 years ago

Hi,

I got the following error when navigating to http://localhost:4000/#/map:

Error: { [Error: query documents: response with invalid 400 status] message: 'query documents: response with invalid 400 status', statusCode: 400, body: { errorResponse: { statusCode: 400, status: 'Bad Request', messageCode: 'SEARCH-BADORDERBY', message: 'SEARCH-BADORDERBY: (err:FOER0000) Indexes are required to support element, element-attribute, json-property, or field sort specifications.' } }, stack: 'From previous event:\n at new Promise (/github/Geophoto/node_modules/marklogic/node_modules/bluebird/js/main/promise.js:87:37)\n at Operation.operationResultPromise (/Users/github/Geophoto/node_modules/marklogic/lib/mlrest.js:1452:17)\n at Object.callBackMethod as result\n at selectAll (/github/Geophoto/routes.js:38:7)\n at apiindex (/github/Geophoto/routes.js:135:5)\n at Layer.handle as handle_request\n at next (/github/Geophoto/node_modules/express/lib/router/route.js:131:13)\n at Route.dispatch (/github/Geophoto/node_modules/express/lib/router/route.js:112:3)' }

It seems that "order by" is not working due to missing indexes. The sorting is likely done in this function in routes.js:

var selectAll = function selectAll() {
    return db.documents.query(
      qb.where(
        qb.collection('image')
      )
      .orderBy(
        qb.sort('filename')
      )
      .slice(0,300) //return 300 documents "per page" (pagination)
    ).result();
};

I enabled ALL indexes via the Admin Interface for the database "Documents", but the error persists. Which indexes in which database shall be enabled for this?

Thanks!

tpiros commented 8 years ago

Hi @ouyi - this just confirms that the setup script did not run correctly. What I'd like you to do is to re-run the setup script. Please make sure that you do not modify anything in the setup script (ml-setup/setup.js) other than the username and password variables in lines 7 & 8 if needed. Please provide me with the output of the script. Thank you.

DineshGuptaa commented 8 years ago

I am newbie to Marklogic and trying to learn through the tutorials. I am facing few issue with the application:

1. I setup the application with error-No semantic data inserted for Colombia. Please guide me to resolve above issue. 2. When tried to run got below message npm install --save jade npm WARN package.json Geophoto@0.0.1 No repository field. npm WARN deprecated jade@1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformer Please guide to remove these errors/warnings.

3. When I ran below command node app.js nothing happen even in browser. http://localhost:4000

how application is going to look like ....

(my apology for poor English ) Thanks Dinesh Gupta

tpiros commented 8 years ago

1) The semantic data is collected from DBPedia so we are relying on third party data - you can go and execute a few SPARQL queries against their system to see what gets returned. 2) I wouldn't worry about the warnings - those are fine - they are not causing any real issues. 3) You need to check the browser logs as well - use Chrome Developer Tools for example to check for errors in the browser and see why the app is not running (have you install the frontend dependencies as well - make sure that 'bower install' gets executed fine).

DineshGuptaa commented 8 years ago

Thanks @tpiros for reply.

  1. It will very helpful if you tell me what & how to run the query.
  2. OK, warning can be ignored.
  3. I checked that bower is installed on my machine. [root@localhost Geophoto]# bower -v 1.8.0 in dbsettings.js I found below entry:

var connection = { host: 'localhost', port: 5003, user: 'admin', password: 'admin' };

module.exports.connection = connection;

but in app.js port is specified as 4000.

Please let me know where am I doing wrong?

Thanks.

dmcassel commented 8 years ago

Maybe you already did this, but @tpiros wasn't just saying to install bower (which you have done), he was saying to run bower install in the root directory of the project. That will install some needed front-end components, just as npm install does for the back end.

DineshGuptaa commented 8 years ago

Thanks for your help...

[dinesh@localhost Geophoto]$ bower install bower invalid-meta for:/opt/MarkLogic/Samples/Geophoto/bower.json bower invalid-meta The "name" is recommended to be lowercase, can contain digits, dots, dashes bower angular#1.3.5 cached https://github.com/angular/bower-angular.git#1.3.5 bower angular#1.3.5 validate 1.3.5 against https://github.com/angular/bower-angular.git#1.3.5 bower jquery#~2.1.1 cached https://github.com/jquery/jquery-dist.git#2.1.4 bower jquery#~2.1.1 validate 2.1.4 against https://github.com/jquery/jquery-dist.git#~2.1.1 bower angular-route#1.3.5 cached https://github.com/angular/bower-angular-route.git#1.3.5 bower angular-route#1.3.5 validate 1.3.5 against https://github.com/angular/bower-angular-route.git#1.3.5 bower bootstrap#~3.2.0 cached https://github.com/twbs/bootstrap.git#3.2.0 bower bootstrap#~3.2.0 validate 3.2.0 against https://github.com/twbs/bootstrap.git#~3.2.0 bower jquery#~2.1.1 install jquery#2.1.4 bower angular-route#1.3.5 install angular-route#1.3.5 bower angular#1.3.5 install angular#1.3.5 bower bootstrap#~3.2.0 install bootstrap#3.2.0

jquery#2.1.4 bower_components/jquery

angular-route#1.3.5 bower_components/angular-route └── angular#1.3.5

angular#1.3.5 bower_components/angular

bootstrap#3.2.0 bower_components/bootstrap └── jquery#2.1.4

screenshot from 2016-11-11 14-19-02

but sill doesn't change any this. Please explain about the ports. May I am doing wrong with port.Also let me know the some URL where I can see the about application.

tpiros commented 8 years ago

@DineshGuptaa port 4000 is fine - can you let me know if you see any errors in your browser's console when you go to 'http://localhost:4000'?

DineshGuptaa commented 8 years ago

I am not seeing any type of error while running the application.

screenshot from 2016-11-11 18-45-40

screenshot from 2016-11-11 18-46-31

What I am doing wrong, I don't know... :-(

dmcassel commented 8 years ago

@DineshGuptaa in Chrome, could you click the View menu, then Developer, then JavaScript Console. Any errors there? You might need to refresh to get them to show up.

Also, please verify that the indexes are set up on the geophoto-content database. You'll find the expected configuration here.

tpiros commented 7 years ago

@DineshGuptaa have you resolved this issue?

DineshGuptaa commented 7 years ago

No resolve yet

On 17 Nov 2016 9:50 p.m., "Tamas Piros" notifications@github.com wrote:

@DineshGuptaa https://github.com/DineshGuptaa have you resolved this issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/marklogic/Geophoto/issues/9#issuecomment-261292598, or mute the thread https://github.com/notifications/unsubscribe-auth/AWSnjxZgttg8Qlcqc4SI8OcDO8r4br-2ks5q_H69gaJpZM4I-VC7 .

tpiros commented 7 years ago

OK let us know if you need further help.