I'm currently developing an Application that uses hyperledger composer.
I use the standard Composer Query Language for queries.
Since I've never seen any query using 'FROM' statement and cannot find any of them online, I wanted to know if any of you already wrote one.
In specific, I have two assets:
asset First identified by name{
o String name
}
asset Second identified by name{
o String name
-->First[] firsts
}
and want to create a query that given an asset 'SECOND' (or it's ID), returns every 'FIRST' contained.
I thought that something like this might work, but actually it doesn't.
query selectFirstsGivenSeconds{
description: "some description"
statement:
SELECT namespace.First
FROM namespace.Second.firsts
WHERE (name == _$secondName)
}
Does anyone ever wrote a Query with 'FROM' keyword in this query language?
Related
I have a rails project that I need to implement a search box in my project , I decide to use elastic search because performance speed of the query in comparison to SQL query it's important . In this project it's important that user could define type of condition like " < , > != , = " .I ask
question
and someone told me that I could use query string to solve these issues. but I have no idea how could I implement in my project this type of query.
In my project, I use two elasticsearch gems, "elasticsearch-rails" and "elasticsearch-model" and follow this tutorial
for implementation in my project but it's not useful for this issues.
could you please tell me how could I implement query string on the rails project?
This is how you run a query_string on RoR :
Article.search(query: { query_string: { query: "(new york city) OR (big apple)"} })
I just read you want to execute SQL queries on ES. That can be done out of the box using the SQL API.
I found the implementation for elasticsearch-ruby here :
https://github.com/elastic/elasticsearch-ruby/tree/master/elasticsearch-xpack
On this file exactly
https://github.com/elastic/elasticsearch-ruby/blob/master/elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/sql/query.rb
And this is the documentation about
https://rdoc.info/gems/elasticsearch-xpack/Elasticsearch%2FXPack%2FAPI%2FSQL%2FActions:query
I have some code which gets details of lists in a SharePoint site then later wants to find out if a list with the same name still exists. This works fine except for list names that contain a colon - I find Graph misinterprets the colon and 'corrupts' the URL.
For instance, in Graph Explorer when I give it the following query:
https://graph.microsoft.com/v1.0/sites('mysite.sharepoint.com,aa-aa-aa,bb-bb-bb')/lists('19:abcdef#thread.tacv2_wiki')
The error response contains the following in the 'message' property:
The expression \"sites('mysite.sharepoint.com,aa-aa-aa,bb-bb-bb')/lists('19')/abcdef#thread.tacv2_wiki\" is not valid.
Note that it's split the original URL, thinking the colon is the start of a new segment in the path, even though it's inside a quote.
I've tried all sorts of quoting of the colon (%3A and %253A and %25253A) and different styles of quote characters, but they all either return the same error or give a parsing error.
More information - I specifically want to search by name not by original id (which would be much easier), I'm acutually using Graph Managed API in code but it generates the same error (you'd think it would internally know how to quote), the list is actually a hidden one created in a Teams site to manage channel information.
I was also able to reproduce your issue but as a work around you can use the filter query parameter to get the list by using below query.
https://graph.microsoft.com/v1.0/sites/soaadteam.sharepoint.com,c1178396-d845-46fa-bc0c-453d2951dad5,19ee9a1e-001d-48f1-9ee8-b0adfde54e45/lists?$filter=displayName eq '19:abcdef#thread.tacv2_wiki'
Hi I'm trying to make a movie app where I'm trying to make a search functionality work. However I'm running into a problem trying to figure out a way to make the search case insensitive as well as ignore the punctuations. I believe another post showed how to get the case insensitive to work by using regular expression
query.whereMatches("name", "("+searchData+")", "i");
However is there something I can do to ignore the punctuations?
For example in the database I have "Mission: Impossible". If a user searches for "Mission impossible" it still won't be able to find it.
A good way to search on an attribute slightly transformed is to do the transformation upon save, then use the simpler (faster) match on query against the transformed attribute. For this question, the transformation is to a case-insensitive, punctuation-free version of an attribute.
Parse.Cloud.beforeSave("MyClass", function(request, response) {
var name = request.object.get("name");
var searchName = name.replace(/['";:,.\/?\\-]/g, '').toLowerCase();
request.object.set("searchName", searchName);
response.success();
});
Now, a case-insensitive, punctuation-free search can be done with maximum simplicity and speed (since it's indexed) on the "searchName" attribute.
I am trying to learn the OData version 4 protocol and am using the Northwind database to run queries against.
OData 4 introduced the free text search with $search but the queries I've tried all fail.
A couple things I tried (with many variants):
http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$search=%28City%20eq%20Berlin%29
http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$search=City%20eq%20Berlin
http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$search=Berlin
Error message I get is: The query parameter '$search' begins with a system-reserved '$' character but is not recognized.
The official docs don't say much here, and just reference another source for the exact format. However, the format is very cryptic to me...
From the docs, the general idea is http://host/service/Products?$search=blue OR green which seems in line with my examples. So not sure what I'm doing wrong here.
Has anyone successfully used this before and could give me an example? Thanks!
You got an error message from http://services.odata.org/V4/Northwind/Northwind.svc because this service has not been updated to support $search. ODL began to support $search in version 6.1.0. please check 6.1.0 release notes
From the spec, "The $search system query option restricts the result to include only those entities matching the specified search expression. The definition of what it means to match is dependent upon the implementation." Since the match rule is dependent on the service implementation, the service can determine which property or even properties combinations to match the search expression.
This service http://odatae2etest.azurewebsites.net/demo/DefaultService/ has simply implemented $search, and this service choose to have the first string type property to match the search expression.
So for this service, http://odatae2etest.azurewebsites.net/demo/DefaultService/ProductDetails?$search=snack is actually meant to return ProductDetails whose description contains 'snack'.
Otherwise, $search supports AND, OR, NOT operations.
The data what i have is
kiran#test.com - first record
kiran1#test.com - second record
I need to search using the email address. I have forums and users indexed in my web app.
First scenario
I kept the '#' symbol in the charset table which is working fine problem is for example if the search keyword as 'kiran#test.com' it is giving me the exact result but if i user only 'test' no results found.
Second scenario
If i won't keep '#' symbol in the charset table. If the i use 'kiran#test.com' i am getting both the results and for 'test' also i am getting both the results
Expected Scenario
If i use the entire email 'kiran#test.com' - I need to get only first record
If i use only 'test' - I need to get both the records
In plain mysql something like "select users where email like '%search-key%'"
I use the following code for searching
ThinkingSphinx.search params[:search_key],:star => Regexp.new('\w+#*\w+', nil, 'u') (I don't want to treat '#' as the separator)
Please suggest me any options i can pass to achieve the expected result.
Thanks
Kiran
Take a look at blended char support
http://sphinxsearch.com/docs/current.html#conf-blend-chars
Or if you really what [ email like '%search-key%'" ] style support maybe min_infix_len. (leaving . and # in charset table)
To search for full email you could use Phrase Search operator.
http://sphinxsearch.com/docs/current.html#extended-syntax
So, if you could determine search query as email use "phrase search" otherwise use general search.