how do I create a “like” filter view in couchdb

前端 未结 7 813
北海茫月
北海茫月 2020-12-30 03:25

Here\'s an example of what I need in sql:

SELECT name FROM employ WHERE name LIKE %bro%

How do I create view li

7条回答
  •  温柔的废话
    2020-12-30 04:14

    i found a simple view code for my problem...

    {
    "getavailableproduct":
           { "map": "function(doc) {
               var prefix = doc['productid'].match(/[A-Za-z0-9]+/g);
               if(prefix)
                  for(var pre in prefix) { emit(prefix[pre],null); }
                }"
           }
    }

    from this view code if i split a key sentence into a key word... and i can call

    ?key="[search_keyword]"

    but i need more complex code because if i run this code i can only find word wich i type (ex: eat, food, etc)...

    but if i want to type not a complete word (ex: ea from eat, or foo from food) that code does not work..

提交回复
热议问题