I want to search in my pouch database in a fast way. The query I have below is very slow even for a small dataset of 1000 items and index on field. I am guessing it is because I am using a regular expressions. I even tried to do the regex as "^"+search (just search the start) and it takes awhile (10 seconds)

What is the best way to do an OR search on the fields below?

Here is code:

```
        db_items.find({
          selector: {name: {$regex: RegExp("^"+search, "i")}},
          fields: ['_id', 'name','unit_price','category','quantity','item_id'],
          sort: ['name']
        }

```

I applied code from answer and am having performance issues still. Taking 20 seconds on 10k documents with index on the name field

```
item_index_creation.push(db_items.createIndex({
  index: {
    fields: ['name']
  }
}));

function item_view_index(doc) 
{
      const regex = /[\s\.;]+/gi;
      ['name'].forEach(field => {
        if (doc[field]) {
          const words = doc[field].replaceAll(regex,',').split(',');
          words.forEach(word => {
            word = word.trim();
            if (word.length) {
              emit(word.toLocaleLowerCase(), [field, word]);
            }
          });
        }
      });
  }

        //This is taking 20+ seconds on 11,000 documents
        const search_results = await db_items.query(item_view_index, {
          include_docs: true,
          reduce: false,
          descending: descending,
          startkey: descending ? search + '\uFFF0' : search,
          endkey: descending ? search : search + '\uFFF0'
        });

        var results = search_results.rows;
        var db_response = [];
        for(var k=0;k<results.length;k++)
        {
            var row = results[k].doc;
            var item = {unit_price: to_currency_no_money(row.unit_price), image: default_image,label: row.name+' - '+to_currency_no_money(row.unit_price),category:row.category,quantity: to_quantity(row.quantity),value: row.item_id};
            db_response.push(item);
        }
        response(db_response);

```