You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/07/20 15:44:07 UTC

[GitHub] [couchdb] bpluly opened a new issue #3014: a search index upon a field which contains numerical strings fails on querying unless an alpha character is included

bpluly opened a new issue #3014:
URL: https://github.com/apache/couchdb/issues/3014


   ## Description
   A document contains a user account object which contains user ids for various platforms that of which they are also a user.
   This is a simple array of a two field structure.
   eg.
   ```
    "_id": xxxxx",
     "_rev": "2-xxx",
     "userAccount": {
       "platforms": [
         {
           "platform": "twitter",
           "userPlatformID": "15078174"
         }
       ],
   ```
   The system needs to be able to lookup the userPlatformID because it wants to associate the user with whatever. The field is a string because an unknown Platform will have whatever ID format it likes, in this case it is a numerical string. However after creating the Search_index no numerical string queried returns any hits.
   
   Given the above document create a Search Index to navigate the documents and safely create an index for the two platforms fields.
   
   ```
   function (doc) {
     index('default', doc._id);
     if (typeof(doc.userAccount) !== 'undefined' ){
       for (platformInd = 0; platformInd < doc.userAccount.platforms.length; platformInd++){
         if (typeof(doc.userAccount.platforms[platformInd].userPlatformID) !== 'undefined'){
           index('platformid', doc.userAccount.platforms[platformInd].userPlatformID, {'index':true, 'store':true}); 
           }
           index('platform', doc.userAccount.platforms[platformInd].platform, {'index':true});
       }
     }
   }  
   ```
   The index builds and any query for 'platform:' will return any hits but no hits for any 'platformid'. Storing the platformid shows in platform: query results that the value is stored as a string. 
   
   After some little time I prefixed the platformid field in the indexing with a 'P' and that returns results. 
   
   Couchdb 3.1.0
   on AWS Linux 2 patched and up to date.
   
   Only tested with Firefox but it's not a client issue, only Fauxton was used to reproduce this.
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb] wohali closed issue #3014: a search index upon a field which contains numerical strings fails on querying unless an alpha character is included

Posted by GitBox <gi...@apache.org>.
wohali closed issue #3014:
URL: https://github.com/apache/couchdb/issues/3014


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org