Skip to content

Full text search - support multiple fields from SDK #5152

Closed

Description

@ranhsd

Hi,
Currently the full text search allows you to create index for one text field only using the following command:

        const query = new Parse.Query(Parse.User);
        query.fullText('firstName', text);
        query.select('$score','firstName','lastName');
        query.ascending('$score');
        const results = await query.find({
            sessionToken: sessionToken
        });

MongoDB support compound text index which allows you to create one index and search on multiple string fields so if I have a user collection and this collection contains 2 fields of: firstName and lastName I want that my app will allow to search users either by their first name of by their last name.

Now, If I go my my collection and create the compound index manually (on both fields) and run the query above it works. But If I don't create the compound index ahead and run the same query then parse will auto create the index for me but this index will be a single index (in the example above it will create the text index for the firstName field only) and it will allows me to search users only by their first name. I think that the fullText function should also receive an array of fields and not only one single field because if it will stay like this we actually lose functionality which can be supported out of the box.

Thanks in advance.

Activity

  1. dplewis commented on Oct 31, 2018

    @dplewis
    Member

    @ranhsd Feel free to open a PR.

  2. rihadavid commented on Nov 2, 2018

    @rihadavid
    Contributor

    It could also somehow accept weights array parameter, maybe in the options parameter (required to be the same length as the fields array), because multi-field text index can define different levels of importance for the resulting score.

  3. stale commented on Dec 17, 2018

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  4. added
    type:featureNew feature or improvement of existing feature
    and removed on Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions