Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - Customizable Field Selection and Content Type Population #149

Open
tobiratzberger opened this issue Jan 24, 2024 · 3 comments

Comments

@tobiratzberger
Copy link

Hey there!

I've been using the fuzzy-search plugin and found it to be a fantastic tool for searching through content. However, I believe there's room for improvement by allowing users to define the fields to be returned and by introducing a more efficient way to handle complex queries through content type population.

Feature Request 1: Customizable Field Selection

Currently, the fuzzy-search plugin returns all fields for a given content type. While this can be useful, there are situations where we only need specific fields for our search results. To address this, I suggest introducing a feature that allows users to define the fields to be returned, providing more control and potentially improving performance on content types with a large number of fields.

Here's an example of how the configuration could look:

// ...
{
    uid: "api::book.book",
    modelName: "book",
    fields: ["name", "description"],
    fuzzysortOptions: {
        // ...
    },
},
// ...

Feature Request 2: Content Type Population for Complex Queries

Building complex queries can be a time-consuming and error-prone process. To simplify this, why not allow users to define content type populations directly within the search configuration? This would serve as a base configuration that can be extended when querying search results, making it much more convenient and reducing the need to build complex queries repeatedly.

Here's an example of how this could work:

// ...
{
    uid: "api::book.book",
    modelName: "book",
    fields: ["name", "description"],
    populate: {
        authors: {
            // - maybe also allow fields here too?
            populate: {
                city: true
            }
        }
    },
    fuzzysortOptions: {
        // ...
    },
},
// ...

These two feature requests would greatly enhance the flexibility and usability of the fuzzy-search plugin, making it even more valuable for developers working with large and complex datasets.

I hope you find these suggestions helpful and consider implementing them in future updates. Thank you for your continued efforts to improve the plugin!

Best regards,
Tobi

@nishk02
Copy link

nishk02 commented Mar 12, 2024

First of all thanks you to the author @DomDew, for making this plugin. This works well with all the general expectations with searching.

@tobiratzberger, I was also looking for the same where I could pass "fields" query parameters in REST API to fetch only those specific fields of a content type. But I think this is not available as of now. Yes I do believe it should improve the fetch performance.

@gregg-cbs
Copy link

+1 on being able to select fields, our responses are huge because of populated data and json fields.

@DomDew
Copy link
Owner

DomDew commented Jul 17, 2024

Hey @tobiratzberger,
thank you for opening this detailed feature request!
I think both of these features would be very nice additions. I'm a bit short on time at the moment though, so things will definitely take some time.
If these features are important to you please feel free to open a PR, they are always welcome! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants