-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support for Filter method String.contains(). #37
Comments
If you want a feature adding you need to fork the code and contribute the feature via a GitHub pull request. |
I need to learn that now. You can put me through. To do this I need to fork both |
FYI Valid JDOQL methods are shown on this link http://www.datanucleus.org:15080/products/accessplatform_5_1/jdo/query.html#jdoql_methods |
If the String.contains() is added it will help. This Cypher code can be used to check for the String that contains a variable value;
OR
I have trying to look for how to add the method by adding code to these files; I am still looking and studying for where the actual method is added so that I can test it. |
The JDOQL is which maps on to a generic compilation of InvokeExpression. InvokeExpression is what you should process in the neo4j plugin. i.e in QueryToCypherMapper.java |
Sorry, Please how do I get that? |
processInvokeExpression in that class I just quoted! just look at other plugins that do querying, and they all handle methods |
I am having small issue on how to release on GitHub. The Zip file doesn't look like the normal jar file. |
No idea what that means. To contribute on GitHub you provide a PULL REQUEST, via the Pull Requests option on the project. |
I will make PULL REQUEST, but wont it be to test the commit before making PULL REQUEST? |
It is for YOU to test the proposed changes, before submitting the PULL REQUEST. Hence it is in your local codebase, so you test it locally |
Yes I test it locally. Shouldn't I extract the jar and run it on my IDE? Or is there any way to test it on GitHub? |
GitHub is a repository. It doesn't test anything. You test it. There are some simply tests under the repository "tests", navigating to "jdo/neo4j", as per what the documentation says. Also, to correct your earlier statement, there is no "startsWith" or "matches" supported by this plugin, as you can see from the processInvokeExpression method. No methods are currently supported. |
To give an idea of how methods can be added (and since we didnt support any on this plugin before) I've added support for String toUpperCase/toLowerCase in issue #38 . Use the code added there as a guide to adding "contains" support for String fields |
You seem to have tried to handle it directly as an operator ( which is converted into a generic compilation of |
Ok. I got you. It is under InvokeExpression. I was thinking it should be under Neo4jBooleanExpression. |
Following your footsteps, I have done this c3b6fb6. My problem is that I have not been able to see where those changes reflected. |
That change makes no sense to me. You have a JDOQL query of
mapping on to Cypher clause of
I'm pretty sure there is no Cypher function for Strings called "contains" http://neo4j.com/docs/developer-manual/current/cypher/functions/#header-query-functions-string |
I thought we could get something like this, not that I was sure;
|
Since that method is not available, I used this code;
I got this stack trace;
When I changed to;
|
It seems that this String method is not supported yet. They could only support Is there any way to do this? |
Only you know wtf 'value' is so nothing to say; you get a variableexpression so must be inputting something weird. You cannot use jdoqltyped queries with string.contains ... Obviously since there is no method in the jdo spec, hence why i post string-based jdoql. Jdoql method invocation is present in 'tests' project jdo/neo4j and all work for me. |
Ok. I have list of names for the Product name, like "Apple", "Man", "AppleMan", "Orange" This is why I am having this headache. How can I be able to accomplish that? Let me have the link to the 'tests' project jdo/neo4j |
I have seen it. https://github.com/datanucleus/tests/blob/master/jdo/neo4j/src/test/org/datanucleus/test/JDOQLTest.java. |
Cumbersome? It's a TEST. Any issue for adding a feature needs a test. Should be the first thing you do. As for the overall "I am trying to search for Product with a name containing", JDOQL has "matches" allowing regexp. You could implement that. Or you could implement "contains". |
These code works;
Thanks again. |
These code works;
Thanks again. |
As already said, that is NOT implemented to execute IN THE DATASTORE; it executes in-memory! You have to implement it to work as a method in the datastore |
Please give an example on how to use the methods you add to QueryToCypherMapper. Let me see what is going on. |
I already have, IN THE TESTS. That does |
An Operator is an INTERNAL JDOQL/JPQL Operator. There is NO "=~" operator in JDOQL/JPQL and so there should not be here either. You should simply generate the Cypher query you think that JDOQL maps on to. Can't get simpler Whether it is in-memory or in-datastore is for YOU to see ... because the LOG tells you! |
It gives me
That is my reason for using |
Why would you try to use Neo4jStringExpression????? It would be mindless. As JRE javadocs tell you, String.contains(CharSequence) returns a Boolean. Hence Neo4jBooleanExpression is what you use!! If you can't work it out from that then frankly it is your problem. I have other things to do. |
Sorry, I am here to learn. This my commit works. Is anything wrong with it?
I have tested it. It works like the normal
As documented here, http://neo4j.com/docs/developer-manual/current/cypher/clauses/where/#_regular_expressions |
Anything wrong with it ? I have already told you on multiple occasions that you should not be touching OPERATIONs, since those are internal JDOQL/JPQL operations and there is no such "=~" in JDOQL/JPQL. So remove that!! You simply need to form the Cypher query equivalent for "String.contains(arg)" and return it in a Neo4jBooleanExpression ... |
I did not understand you before. My eyes did not go towards that constructor;
I have done these; It is still working as expected, but there is one issue with Literal. |
You are ignoring "neo4jExprArgs" which is the processed form of the "args" from earlier in that method; use those and not "args". You are ignoring DataNucleus code conventions http://www.datanucleus.org/documentation/development.html#coding_standards |
I do not think it can allow the argument to be a Parameter unless the parameter name is converted to String.
The documentation is here, http://neo4j.com/docs/developer-manual/current/cypher/clauses/where/#_regular_expressions |
I don't see anything here that isn't in the current codebase |
Hi!
We already have the following Filter methods,
.eq() => equals to
.ne() => not equal to
.startsWith() => begins with
.matches() => exact value
Can we have method to search for string which contains a string value?
For instance, if a string like
Appletogether
, searching fortoget
is true.I have not seen the method for that.
The text was updated successfully, but these errors were encountered: