Search code examples
couchdbcloudant

How would I enable partial search and case ignore in Cloudant Search Index?


Search function

function (doc) {
  for(var j =1;j<doc.sheets[1].data.length;j++){
      index("Name", doc.sheets[1].data[j]);    
  }
}

My analyzer is standard. How would I modify this function so as to achieve search with partial matching.


Solution

  • you should be able to use * and other from special characters as part of the query syntax to perform wildcard searches, fuzzy searches, etc.

    from https://console.bluemix.net/docs/services/Cloudant/api/search.html#query-syntax:

    If you want a fuzzy search, you can run a query with ~ to find terms like the search term. For instance, look~ finds the terms book and took.

    and

    Wildcard searches are supported, for both single (?) and multiple (*) character searches. For example, dat? would match date and data, whereas dat* would match date, data, database, and dates.