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

Expose minimal full text search #5755

Closed
sync-by-unito bot opened this issue Apr 21, 2023 · 4 comments · Fixed by #5797
Closed

Expose minimal full text search #5755

sync-by-unito bot opened this issue Apr 21, 2023 · 4 comments · Fixed by #5797
Assignees

Comments

@sync-by-unito
Copy link

sync-by-unito bot commented Apr 21, 2023

No description provided.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 2, 2023

➤ Kyle Rollins commented:

[~[email protected]], is this work going into Realm.js v12.0.0? I want to make sure I've got the timing right for docs.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 3, 2023

➤ papafe commented:

[~[email protected]] yes, this should be included in the final v12 version

@GitMurf
Copy link

GitMurf commented Aug 24, 2023

Is full-text indexing and corresponding queries for it in the docs anywhere yet? I can't find it anywhere. I see the TS types properly exposes 'full-text' as an option for the indexed prop type but that is basically all I see anywhere. Thanks!

@papafe
Copy link
Contributor

papafe commented Aug 24, 2023

Hey @GitMurf, we're still working on adding the info to the docs, you're correct. But summing up to use full-text search you need to:

  • Specify the string properties that need to be full-text indexed in the schema. For example:
class Story extends Realm.Object<Story> implements IStory {
  title?: string;
  content?: string;

  static schema: ObjectSchema = {
    name: "Story",
    properties: {
      title: { type: "string" },
      content: { type: "string", indexed: "full-text" },
    },
    primaryKey: "title",
  };
}
  • Use TEXT in the query when you want to use full-text search:
const stories = realm.objects("Story");
const filtered = stories.filtered("content TEXT $0", "two dog");

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants