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

Index by Json function for weird searches #514

Open
jeremydmiller opened this Issue Sep 6, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@jeremydmiller
Contributor

jeremydmiller commented Sep 6, 2016

As an end around whatever weird things you want to do in queries that Marten's Linq support just can't handle (weird stuff in child collections, etc.), what if we purposely exploited PLV8 functions inside of calculated indexes, and then allowed you to use these functions in querying?

Something like:

// functions that return a boolean
session.Query<Target>().Where(x => x.Matches("function name")).ToList();

// functions that return a string
session.Query<Target>().Where(x => x.Value<string>("function name") == "something").ToList();

We've already proven that functions marked as IMMUTABLE in Postgresql can be used as part of a calculated index, so this might very well be viable.

@jeremydmiller jeremydmiller changed the title from Index by Json function to Index by Json function for weird searches Sep 6, 2016

@jeremydmiller jeremydmiller modified the milestone: 1.1 Sep 22, 2016

@jeremydmiller jeremydmiller modified the milestones: 1.1, 1.2 Oct 4, 2016

@jeremydmiller jeremydmiller modified the milestones: 1.2, 1.3 Oct 31, 2016

@jeremydmiller jeremydmiller modified the milestone: 1.3 Feb 8, 2017

@jeremydmiller jeremydmiller modified the milestone: 2.0 Mar 23, 2017

@jeremydmiller jeremydmiller modified the milestones: 2.0, 2.1 Jun 7, 2017

@jeremydmiller jeremydmiller modified the milestone: 2.1 Aug 11, 2017

@jeremydmiller jeremydmiller modified the milestone: 2.4.0 Nov 10, 2017

@mdissel

This comment has been minimized.

Contributor

mdissel commented Dec 31, 2017

Alternative for duplicate field, indexed function. See https://blog.anayrat.info/en/2017/11/26/postgresql---jsonb-and-statistics/

@jeremydmiller jeremydmiller added this to the 3.0 milestone Aug 31, 2018

@jeremydmiller jeremydmiller removed this from the 3.0 milestone Sep 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment