# Search no longer working

**URL:** <https://community.forestadmin.com/t/search-no-longer-working/3340>\
**Category:** Help me!\
**Created:** [September 24, 2021, 9:54am UTC](https://community.forestadmin.com/t/search-no-longer-working/3340 "2021-09-24T09:54:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeremyV](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/jeremyv/32/1033_2.png) [@JeremyV](https://community.forestadmin.com/u/JeremyV)\
**Post date:** [September 24, 2021, 9:54am UTC](https://community.forestadmin.com/t/search-no-longer-working/3340/1 "2021-09-24T09:54:11Z")

</div>

In my project, in most of my collections, Search is not working anymore. I get this :

```javascript
[forest] 🌳🌳🌳 Unexpected error: enumValue.toLowerCase is not a function
{
  "stack": "TypeError: enumValue.toLowerCase is not a function\n
    at C:\\Users\\jvollant\\WebDev\\Syndic One Rebirth\\node_modules\\forest-express-sequelize\\dist\\services\\search-builder.js:205:25\n
    at arrayEach (C:\\Users\\jvollant\\WebDev\\Syndic One Rebirth\\node_modules\\forest-express-sequelize\\node_modules\\lodash\\lodash.js:530:11)\n
    at Function.forEach (C:\\Users\\jvollant\\WebDev\\Syndic One Rebirth\\node_modules\\forest-express-sequelize\\node_modules\\lodash\\lodash.js:9410:14)\n
    at C:\\Users\\jvollant\\WebDev\\Syndic One Rebirth\\node_modules\\forest-express-sequelize\\dist\\services\\search-builder.js:204:11\n   
    at arrayEach (C:\\Users\\jvollant\\WebDev\\Syndic One Rebirth\\node_modules\\forest-express-sequelize\\node_modules\\lodash\\lodash.js:530:11)\n
    at Function.forEach (C:\\Users\\jvollant\\WebDev\\Syndic One Rebirth\\node_modules\\forest-express-sequelize\\node_modules\\lodash\\lodash.js:9410:14)\n
    at SearchBuilder.perform (C:\\Users\\jvollant\\WebDev\\Syndic One Rebirth\\node_modules\\forest-express-sequelize\\dist\\services\\search-builder.js:163:7)\n
    at SearchBuilder.performWithSmartFields (C:\\Users\\jvollant\\WebDev\\Syndic One Rebirth\\node_modules\\forest-express-sequelize\\dist\\services\\search-builder.js:108:33)\n
    at QueryOptions.search (C:\\Users\\jvollant\\WebDev\\Syndic One Rebirth\\node_modules\\forest-express-sequelize\\dist\\services\\query-options.js:212:16)\n
    at ResourcesGetter._buildQueryOptions (C:\\Users\\jvollant\\WebDev\\Syndic One Rebirth\\node_modules\\forest-express-sequelize\\dist\\services\\resources-getter.js:94:24)\n
    at async ResourcesGetter.count (C:\\Users\\jvollant\\WebDev\\Syndic One Rebirth\\node_modules\\forest-express-sequelize\\dist\\services\\resources-getter.js:41:30)"
}

```

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [September 24, 2021, 10:01am UTC](https://community.forestadmin.com/t/search-no-longer-working/3340/2 "2021-09-24T10:01:38Z")

</div>

Hi @JeremyV ,

It seems you have a bad declaration of your enum values. Could you please share the value of your enum fields ?

---

<div class="post-metadata">

**Author:** ![JeremyV](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/jeremyv/32/1033_2.png) [@JeremyV](https://community.forestadmin.com/u/JeremyV)\
**Post date:** [September 24, 2021, 10:15am UTC](https://community.forestadmin.com/t/search-no-longer-working/3340/3 "2021-09-24T10:15:49Z")

</div>

For instance :

```javascript
  const Places = sequelize.define('places', {
    displayName: {
      type: DataTypes.STRING,
      defaultValue: "",
      allowNull: false,
    },
    score: {
      type: DataTypes.INTEGER,
    },
    createdAt: {
      type: DataTypes.DATE,
    },
    updatedAt: {
      type: DataTypes.DATE,
    },
    numberOfLots: {
      type: DataTypes.INTEGER,
      defaultValue: 0,
      allowNull: false,
    },
    numberOfBuildings: {
      type: DataTypes.INTEGER,
      defaultValue: 0,
      allowNull: false,
    },
    sergicId: {
      type: DataTypes.INTEGER,
    },
    sergicUpdateTime: {
      type: DataTypes.DATE,
    },
    openReportCount: {
      type: DataTypes.INTEGER,
      defaultValue: 0,
      allowNull: false,
    },
    icsCode: {
      type: DataTypes.STRING,
    },
    pictureName: {
      type: DataTypes.STRING,
    },
    sergicOffer: {
      type: DataTypes.ENUM(['DIR', 'ESE', 'VSY']),
      defaultValue: "",
    },
    sergicIdFull: {
      type: DataTypes.STRING,
    },
    individualized: {
      type: DataTypes.BOOLEAN,
    },
    separated: {
      type: DataTypes.BOOLEAN,
    },
    temporary: {
      type: DataTypes.BOOLEAN,
      defaultValue: false,
    },
    inviteStatus: {
      type: DataTypes.BOOLEAN,
      defaultValue: false,
    },
    inviteUrl: {
      type: DataTypes.STRING,
    },
    wpCode: {
      type: DataTypes.STRING,
    },
    synchronizedWithSergicAt: {
      type: DataTypes.DATE,
    },
    fiscalYearMonth: {
      type: DataTypes.ENUM([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
    },
    description: {
      type: DataTypes.STRING,
    },
    support247: {
      type: DataTypes.BOOLEAN,
      field: 'support_24_7',
      defaultValue: false,
    },
    workAdvance: {
      type: DataTypes.INTEGER,
    },
    firstRegulation: {
      type: DataTypes.DATE,
    },
    siret: {
      type: DataTypes.STRING,
    },
    serviceResidence: {
      type: DataTypes.BOOLEAN,
    },
    cooperativeSyndicate: {
      type: DataTypes.BOOLEAN,
    },
    principalSyndicate: {
      type: DataTypes.BOOLEAN,
    },
    constructionPeriod: {
      type: DataTypes.ENUM([
        'before_1949',
        'from_1949_to_1960',
        'from_1961_to_1974',
        'from_1975_to_1993',
        'from_1994_to_2000',
        'from_2001_to_2010',
        'after_2011',
        'unknown'
      ]),
    },
    canTalk: {
      type: DataTypes.BOOLEAN,
      defaultValue: true,
    },
    integrationState: {
      type: DataTypes.ENUM([
        'new', // Nouveau : Docs.en attente
        'awaiting_document_validation',	// Documents à valider
        'management_integration', // Intégration gestion
        'awaiting_budget_validation', // Attente validation budget
        'send_report', // Rattachement & PV à envoyer
        'invalid_budget', // Budget refusé à revoir
        'sage', // Intégration Comptable - SAGE
        'awaiting_archives', // Attente archives
        'done', // Actif
        'pending_lost', // Immeuble perdu à transférer
        'lost' // Immeuble perdu
      ]),
    },
    historicalMonument: {
      type: DataTypes.BOOLEAN,
    },
    loan: {
      type: DataTypes.BOOLEAN,
    },
    registrationNumber: {
      type: DataTypes.STRING,
    },
    kind: {
      type: DataTypes.ENUM([
        'habitation',
        'mixed',
        'asl',
        'parking',
        'commercial'
      ]),
    },
    orderPerilStartDate: {
      type: DataTypes.DATEONLY,
    },
    orderPerilEndDate: {
      type: DataTypes.DATEONLY,
    },
    dtg: {
      type: DataTypes.BOOLEAN,
    },
    dpe: {
      type: DataTypes.STRING,
    },
    generalMeetingDate: {
      type: DataTypes.DATEONLY,
    },
    difficulty: {
      type: DataTypes.BOOLEAN,
    },
    energyAudit: {
      type: DataTypes.BOOLEAN,
    },
    deletedAt: {
      type: DataTypes.BOOLEAN,
    },
    coownershipRegistrationDate: {
      type: DataTypes.DATE,
    },
  }, {
    tableName: 'places',
    underscored: true,
    schema: process.env.DATABASE_SCHEMA,
  });

```

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [September 24, 2021, 11:54am UTC](https://community.forestadmin.com/t/search-no-longer-working/3340/4 "2021-09-24T11:54:21Z")

</div>

> [@JeremyV](#):
>
> `DataTypes.ENUM([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])`

Okey, your issue comes from this line. Could you try putting string instead 🙏. In the meantime, I’ll create an issue to fix that 😉

---

<div class="post-metadata">

**Author:** ![JeremyV](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/jeremyv/32/1033_2.png) [@JeremyV](https://community.forestadmin.com/u/JeremyV)\
**Post date:** [September 24, 2021, 12:32pm UTC](https://community.forestadmin.com/t/search-no-longer-working/3340/5 "2021-09-24T12:32:58Z")

</div>

Okay but this is really not convenient. This field is stored as an integer and I need to alias it (1=\>‘January’ etc.)  
Please keep me posted.

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [September 27, 2021, 7:12am UTC](https://community.forestadmin.com/t/search-no-longer-working/3340/6 "2021-09-27T07:12:57Z")

</div>

Wait if it’s an integer you should declare it as an integer. You can the on Forest Admin use it as an enum by updating the options “Alter Values” of the edit/display widget 😉. You will have the same as simply using the enum like you did
