-
Notifications
You must be signed in to change notification settings - Fork 145
How can pass url and url param(key/value pair) into couchdb-lucene index view #254
Comments
I am stuck here, hope sb help this out, thanks |
@rnewson, thnx |
How can pass the url to the couchdb-lucene index view(
|
the index function is not called at query time, but at index time, so you can't pass the url to it. you can index any number of key/value pairs with your function and then query those later. Unfortunately it is not clear from your description here exactly what problem you are having. |
thanks for your following this issue, I hope get some suggestion here Here is my issue, I have some couchdb document metaData structure like following part
Now I want to get the multiple pairs of key/value results like this result
What I designed in the couchdb lucence index view is as following
Then I call request at: But I can also get the following results which is not expected pair :
I found if my index view include the key name (e.g. doc.metaData[u].key == 'serial_number') it can get correct pair results, but it is hard coded in the index which is not good
How can I do correct key/value pair with out hard code key as condition defined in the index view? Thank you |
ok, I think I get you. I think you want this;
then try ?q=register_infor:abcde should match as you expect, etc. |
Thanks a lot @rnewson, good idea and it is working Seems this idea is support metaDataKey and metaDataValue params pairs. this will not support single one searchlike? ...metaDataKey1=serial_number&metaDataKey2=register_infor, right? Thank you |
@rnewson, another question, why if there are spaces within the key, like I run Thank you |
standard Lucene query syntax, I believe you need to do ?q="Mobile Product":1234567 for the parser to recognise field names with spaces in them.
… On 26 Jul 2017, at 08:19, wonderfuljamesjin ***@***.***> wrote:
@rnewson, another question, why if there are spaces within the key, like I run ?q=Mobile Product:1234567, why no result return? how to fix this?
Thank you
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks @rnewson
|
Ah sorry I misremembered. I think you can't have white space in field names.
…Sent from my iPhone
On 26 Jul 2017, at 11:10, wonderfuljamesjin ***@***.***> wrote:
Thanks @rnewson
If I change this as following, it will have 400 error?
?q=%22Problem%20Area%22:%22Configuration%20Assistance%22
"reason":"Bad query syntax: Cannot parse '\"Problem Area\":\"Configuration Assistance\"': Encountered \" \":\" \": \"\" at line 1, column 14.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ","code":400}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks @rnewson, so is there way to fix the issue that there are spaces within the key? |
Change your index function to swap spaces for underscore in your field names.
…Sent from my iPhone
On 26 Jul 2017, at 11:25, wonderfuljamesjin ***@***.***> wrote:
Thanks @rnewson, so is there way to fix the issue that there are spaces within the key?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hi @rnewson thanks, I am not following your suggestion, you mean replace the spaces for underscore in field there? Thanks |
Thanks @rnewson , I know how to fix this issue, thank you |
Hello All
Is there existed couchedb/couchdb-lucene api or good way to pass couchdb-lucene call final url url and url's param(key/value pair)param into couchdb-lucene index view defined?I have several couchdb document existed like following structure:
register": [ { "key": "serial_number", "value": "aaaaaaaaa" }, { "key": "register_information", "value": "abcde", } ...... ]
Here is a part of couchdb-lucene index view :
how can I get url and param value from URL using javascript like following registerKey/Value[i]'s serialNumber, aaaaaaaaa,register_information,abcde
http://127.0.0.1:5984/_fti/local/db/_design/designdoc/abc?q=registerKey1:"serialNumber"%20AND%20registerValue11:"aaaaaaaaa"%20AND%20registerKey2:"register_information"%20AND%20registerValue2:"abcde"&include_docs=true
Thanks for help!
The text was updated successfully, but these errors were encountered: