DomDew/strapi-plugin-fuzzy-search

🪲Bug on Search Request

cl8dep opened this issue · 2 comments

I has done a request to http://localhost:1337/api/fuzzy-search/search?query=a for testing purposes and the Strapi server return 500.

image

My plugin config is:

  "fuzzy-search": {
    enabled: true,
    config: {
      contentTypes: [
        {
          uid: "api::case.case",
          modelName: "case",
          // queryConstraints: {
          //   where: {
          //     $and: [
          //       {
          //         publishedAt: { $notNull: true },
          //       },
          //     ],
          //   },
          // },
          fuzzysortOptions: {
            characterLimit: 300,
            threshold: -600,
            limit: 10,
            keys: [
              {
                name: "title",
                weight: 100,
              },
              {
                name: "name",
                weight: 100,
              },
            ],
          },
        },
      ],
    },
  },

And my case model is

{
  "kind": "collectionType",
  "collectionName": "cases",
  "info": {
    "singularName": "case",
    "pluralName": "cases",
    "displayName": "Cases",
    "description": ""
  },
  "options": {
    "draftAndPublish": true,
    "searchable": true
  },
  "pluginOptions": {},
  "attributes": {
    "title": {
      "type": "string"
    },
    "name": {
      "type": "string",
      "searchable": true
    },
    "goal": {
      "type": "string"
    },
    "description": {
      "type": "text",
      "searchable": true
    },
    "image": {
      "type": "media",
      "multiple": false,
      "required": false,
      "allowedTypes": [
        "images"
      ]
    },
    "company": {
      "type": "component",
      "repeatable": false,
      "component": "shared.company"
    },
    "slug": {
      "type": "uid",
      "targetField": "title",
      "required": true
    },
    "hero": {
      "type": "component",
      "repeatable": false,
      "component": "sections.cases-hero"
    },
    "sections": {
      "type": "component",
      "repeatable": true,
      "component": "sections.cases-info-laptop"
    },
    "testimonials": {
      "type": "component",
      "repeatable": false,
      "component": "sections.cases-testimonials"
    },
    "contactUs": {
      "type": "component",
      "repeatable": false,
      "component": "form.contact-form"
    },
    "otherCases": {
      "type": "relation",
      "relation": "oneToMany",
      "target": "api::case.case"
    },
    "technologies": {
      "type": "relation",
      "relation": "oneToMany",
      "target": "api::technology.technology"
    }
  }
}

Hey @cl8dep,
thanks for submitting this bug! Are you by any chance on the version 1.10.0-beta.1? It's a known bug I'm trying to fix right now. Should this be the case please consider reverting to the version 1.9.5

Fixed in 1.10.0-beta.2