json - Full text index is not working in cloudant -



json - Full text index is not working in cloudant -

full text index search function not working in cloudant.

document 1 :

{ "_id": "527c8d9327c6f27f17df0d2e17000530", "_rev": "9-4a61c6dac8d03a7d55696c3dde6a4f50", "employee_id": "sci130202", "proj_role": "team member", "work_total_experience": "4", }

document 2 :

{ "_id": "527c8d9327c6f27f17df0d2e17000531", "_rev": "9-4a61c6dac8d03a7d55696c3dd46a4f50", "employee_id": "sci130201", "proj_role": "developer", "work_total_experience": "2", }

index function:

{ "_id": "_design/search_emp", "_rev": "3-4562324d684a2f13d2a1f6f570736e7e", "views": {}, "language": "javascript", "indexes": { "by_employee": { "analyzer": "standard", "index": "function(doc){index(doc.proj_role,{'field':'project_role'})index(doc.work_total_experience,{'field':'work_experience'})}" }}}

if passing in url : https://{username}.cloudant.com/databasename/_design/search_emp/_search/by_employee?q=project_role:developer & work_experience:2

this works 1 condition, need exact output developer 2 year experience details.

this worked me...

here design doc:

{ "doc": { "_id": "_design/search_emp", "_rev": "17-e7f119c21ca21cc6ac44c5a967cd5550", "indexes": { "by_employee": { "analyzer": "standard", "index": "function(doc) {\n index('project_role', doc.proj_role, {});\n index('work_experience', doc.work_total_experience, {});\n}" } }, "language": "javascript", "views": {} }, "id": "_design/search_emp", "key": "_design/search_emp", "value": { "rev": "17-e7f119c21ca21cc6ac44c5a967cd5550" } }

the url:

https://username.cloudant.com/databasename/_design/search_emp/_search/by_employee?include_docs=true&q=work_experience:%222%22%20and%20project_role:developer

note: had have double quotes around experience value. work_experience:"2" worked me, work_experience:2 didn't work.

the response:

{ "bookmark": "g2waaaabaankabxkymnvcmvazgiylm1lywquy2xvdwrhbnqubmv0baaaaajiqaaaagj_____amgcrj_bxezgaaaayqbq", "rows": [ { "doc": { "_id": "90958a20a020a7483d3311a156fcf571", "_rev": "1-795df1c239d3d029eaa6d8c45ef70a8c", "employee_id": "sci130201", "proj_role": "developer", "work_total_experience": "2" }, "fields": {}, "id": "90958a20a020a7483d3311a156fcf571", "order": [ 0.4339554011821747, 0 ] } ], "total_rows": 1 }

json lucene couchdb cloudant

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -