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

Full text search - support multiple fields from SDK #5152

Closed
ranhsd opened this issue Oct 28, 2018 · 3 comments
Closed

Full text search - support multiple fields from SDK #5152

ranhsd opened this issue Oct 28, 2018 · 3 comments
Labels
type:feature New feature or improvement of existing feature

Comments

@ranhsd
Copy link
Contributor

ranhsd commented Oct 28, 2018

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.

@dplewis
Copy link
Member

dplewis commented Oct 31, 2018

@ranhsd Feel free to open a PR.

@rihadavid
Copy link
Contributor

rihadavid commented Nov 2, 2018

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.

@stale
Copy link

stale bot commented Dec 17, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

4 participants