strapi-plugin-fuzzy-search icon indicating copy to clipboard operation
strapi-plugin-fuzzy-search copied to clipboard

No results for single types

Open s-kennedy opened this issue 1 year ago • 1 comments

I'm having trouble getting results for single types. For collection types I'm getting results as expected. But for single types it comes back as an empty array even when I search the exact text of the title. I've tried adding and removing other options like characterLimit and threshold but it's not having any effect.

This is my config:

module.exports = ({ env }) => ({
  "fuzzy-search": {
    enabled: true,
    config: {
      contentTypes: [
        ...
        {
          uid: "api::donate-page.donate-page",
          modelName: "donate-page",
          fuzzysortOptions: {
            keys: [
              {
                name: "title",
                weight: 200,
              },
              {
                name: "subtitle",
                weight: -200,
              }
            ],
          },
        },
       ...
      ],
    },
  }
});

Any thoughts?

s-kennedy avatar Nov 23 '23 03:11 s-kennedy

Hey hey @s-kennedy,

thanks for reporting this! Searching on single-types does indeed not work at the moment.

Generally it should be possible to include this feature, but I fail to see right now why you would want to fuzzy search on a single type? Could you maybe clarify your use case a bit more? At the moment I can't fully comprehend the need for fuzzy searching on a single type, as (judging from your example) the donate page will always just have the one title and subtitle and not multiple entries, or am I missing something?

In any case, I should make it clear in the docs that single types are not supported 😓.

Edit: Ah, I think I understand your use case, are you looking to implement a global search across all content types and pages?

DomDew avatar Nov 30 '23 08:11 DomDew