GMishx commented on issue #4997:
URL: https://github.com/apache/couchdb/issues/4997#issuecomment-2024829125

   @rnewson Even using the provided suggestions from #5018 fail for different 
case.
   
   I have a document with fields name and version. Version is stored as a 
string in couchdb and sample values are `"1", "2", "4.2.0"`. With default 
analyzer (`simple_asciifolding`), these values were getting lost:
   ```bash
   $ curl --user "admin:admin" 'http://localhost:5984/_nouveau_analyze' -X POST 
-H 'Content-Type: application/json' -d '{"analyzer": "simple_asciifolding", 
"text": "4.2.0"}' | jq
   {
     "tokens": []
   }
   ```
   
   Thus I created the index as following:
   ```json
   {
     "_id": "_design/lucene",
     "_rev": "238-6e02d3801cc64311f5244cb242855e82",
     "nouveau": {
       "projects": {
         "default_analyzer": "keyword",
         "field_analyzers": {
           "version": "keyword"
         },
         "index": "function(doc) {\nif(doc.version !== undefined && doc.version 
!= null && doc.version.length >0) {\n      index('text', 'version', 
doc.version, {'store': true});\n    }\n}"
       }
   }
   ```
   
   Notice I added `field_analyzer` on the `version` field to `keyword` as #5018 
suggested. I also tried using field type as `string` as well as `text`. But in 
all cases, I cannot query the document containing `"version:4.2.0"` or 
`"version:1"`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to