Graphql Inline Fragments search options - graphql

So i am using graphql feature in Orchard to get data from the events type,
each eventsItem has a bag of Event as it shows the image bellow
So the problem is that i need to fetch an event with its "contentItemId",is there a way to add where clauses in an inline Fragment.

Fragments are just a way to specify the selection set (i.e. fields) by type at runtime. They are not a way to filter results. GraphQL does not provide any built-in way to filter, sort or otherwise mutate the results -- it's up to each individual service to implement those features. If the schema doesn't expose any argument on the events, bag, or contentItems fields to let you do the sort of filtering you're trying to do, then it's not possible to do so through a query.

Related

Elasticsearch: Add field on the fly like driving distance by a user searching

Is there a way to dynamically append a driving distance of the CONSUMER in ES?
I am trying to create an app and sort PROVIDERS by driving distance.
One thing I could think of is get all the PROVIDERS within a range then put them in an array. Iterate to add driving distance then sort array. But this is not efficient.
Any suggestions?
thank you!
You can use runtime fields to achieve what you want, A runtime field is a field that is evaluated at query time. Runtime fields enable you to:
Add fields to existing documents without reindexing your data Start
working with your data without understanding how it’s structured
Override the value returned from an indexed field at query time
Define fields for a specific use without modifying the underlying
schema
For more information you can check Elasticsearch blog post here, and for runtime fields here.

List firestore collection ids filtered by criteria

In Go package for firestore I can easily get list of IDs by doing something like
client.Collection("mycollection").DocumentRefs()
with query I can easily filter documents before I can iterate over them
client.Collection("mycollection").Where("x", "==", "y").Documents()
But Query seems to be missing an option to get just the .DocumentRefs() is there some way to get list of DocumentRefs matching specific query without actually fetching all the matching Documents (incuring read costs for each)?
The bottom line is that after I apply the filtering logic to get constrained list of doc IDs I want to run additional regex based filtering on the values of the IDs, and the list of filtered IDs is my final result, no need fr fetching docs.
Firestore queries always return the entire contents of every matching document. There are no "light" queries that just return document IDs or references. This is the case for all provided Firestore SDKs, not just go.
In general, it's advisable not to store data in the ID of a document for the purpose of filtering. Your use case will work better if you're able to precompute the conditions where a document should match, and put that data in a field of the document. It should be noted also that Firestore doesn't support regex type queries, as those do not scale massively as Firestore requires.

Perform 'Is one of' filter using Dynamics365 Odata filter

When filtering in fields on D365, we have the filter option of 'is one of' which is more like SQL's where in clause. I'm trying to perform such filter operation using Odata but can't find the right way. Lambda has an any and all but don't know how to throw in a list to compare against.
Try using the In Function.
?$filter=Microsoft.Dynamics.CRM.In(PropertyName=#p1,PropertyValues=#p2)&#p1='name'&#p2=['value','value']
The full list of filter's.

Drupal Views Complex Grouped Filters

I have a Math Expression ($field_a - $field_b) that I want to create an exposed grouped filter for (select-list) so that I can effectively filter out my results.
How can I set this up so that users will be give two options based on the values of two field?
I ended up creating a custom field handler for this purpose.

Passing parameters to a couchbase view

I'm looking to search for a particular JSON document in a bucket and I don't know its document ID, all I know is the value of one of the sub-keys. I've looked through the API documentation but still confused when it comes to my particular use case:
In mongo I can do a dynamic query like:
bucket.get({ "name" : "some-arbritrary-name-here" })
With couchbase I'm under the impression that you need to create an index (for example on the name property) and use startKey / endKey but this feels wrong - could you still end up with multiple documents being returned? Would be nice to be able to pass a parameter to the view that an exact match could be performed on. Also how would we handle multi-dimensional searches? i.e. name and category.
I'd like to do as much of the filtering as possible on the couchbase instance and ideally narrow it down to one record rather than having to filter when it comes back to the App Tier. Something like passing a dynamic value to the mapping function and only emitting documents that match.
I know you can use LINQ with couchbase to filter but if I've read the docs correctly this filtering is still done client-side but at least if we could narrow down the returned dataset to a sensible subset, client-side filtering wouldn't be such a big deal.
Cheers
So you are correct on one point, you need to create a view (an index indeed) to be able to query on on the content of the JSON document.
So in you case you have to create a view with this kind of code:
function (doc, meta) {
if (doc.type == "youtype") { // just a good practice to type the doc
emit(doc.name);
}
}
So this will create a index - distributed on all the nodes of your cluster - that you can now use in your application. You can point to a specific value using the "key" parameter

Resources