LIKE operator not supported in arango search view - arangodb

Arango Search does not seem to support LIKE operator.
Other supported operators are working fine.
Tried this AQL:
FOR s IN searchView
SEARCH s.name LIKE "somesubstring"
RETURN s
But it gives an error saying:
Query: AQL: not implemented: Unable to evaluate loop variable 's' as a
part of ArangoSearch noncompliant expression
'LIKE([$0.name,"somesubstring"])' (exception location:
C:\vm04-windows\oskar\work\ArangoDB\arangod\IResearch\IResearchExpressionContext.cpp:62)
(while executing) (exception location:
C:\vm04-windows\oskar\work\ArangoDB\arangod\RestHandler\RestCursorHandler.cpp:298)
Referred this: https://www.arangodb.com/docs/3.6/aql/operations-search.html
Other supported operators are working fine.
How do we achieve this in Arango search view?
LIKE operator or mimicking the same behavior.
Issue reference: https://github.com/arangodb/arangodb/issues/11176

LIKE (introduced in v3.7.0), also NOT LIKE
The Alpha Version is Out now. You can test.

Related

Groovy Pattern for matching a value in map

Hy guys, i'm working on a IDEA plugin and custom references. I have many references working, but i'm stuck with a difficult one.
I'd like to detect patterns in groovy such as this one :
result = run service: 'createAgreementItem', with: createAgreementItemInMap
In the above line, i'd like to get the createAgreementItem element to match.
run is defined in a groovy base script
package org.apache.ofbiz.service.engine
abstract class GroovyBaseScript extends Script {
//...
Map run(Map args) throws ExecutionServiceException {
return runService((String)args.get('service'), (Map)args.get('with', new HashMap()))
}
//...
The problem is, what i'm trying to get isn't technically a parameter, it's a value from a map with the key equals to service.
So this won't work :
GroovyPatterns.groovyLiteralExpression()
.methodCallParameter(0,
GroovyPatterns.psiMethod().withName("run")
.definedInClass("org.apache.ofbiz.service.engine.GroovyBaseScript"))
Do you have any ideas or any help ? Thanks in advance !
EDIT :
Actually, i'm looking for a doc or an example for any use of the org.jetbrains.plugins.groovy.lang.psi.patterns.GroovyPatterns
library.
I don't get it, maybe i'm not familiar enough with groovy though i used it a bit.
Any help welcome on this.
The problem is, what i'm trying to get isn't technically a parameter,
it's a value from a map with the key equals to "service"
If all you want to do is retrieve the service value from the Map then instead of args.get('with', new HashMap()) you could do args.with.service. If you wanted null safety, you could do args?.with?.service.

Changed behavior in object field access in Groovy 3.0?

I've recently stumbled on this issue when assisting in the migration of some legacy code.
The following used to execute correctly in Groovy 2.4.x :
class Person {
String name
}
def me = new Person( name : 'Joe' )
assert me.(name) == 'Joe'
while it raises an exception when executed on Groovy 3.0.2 :
groovy.lang.MissingPropertyException: No such property: name for class: MyScript
Enclosing the property name in parentheses actually looks wrong to me: as a matter of fact, I was surprised that an exception was not raised in older releases too.
The syntax I would probably have used is either:
assert me.name == 'Joe'
or something like:
assert me.'name' == 'Joe'
which work in both versions 2.4 AND 3.0.
I did some research and couldn't find anything in the Changelogs from Groovy 2.4 through Groovy 3.0 that refers to something that could affect this behavior.
Am I missing something here?
Was the fact that the code worked in 2.4 an unexpected behavior, which has been corrected?
Or is this actually expected to work?
My guess is that it has to do with the switch to the new Parrot parser in version 3.0.
Thanks!
When you wrap the property name in parens, like "me.(name)", you are using dynamic property syntax. Groovy is supposed to resolve "name" in the enclosing scope and not against the receiver. If you want to get the "name" property from "me", you can write "me.name" or "me.'name'" or "me['name']" or "me.getProperty('name')".

Mapping IQueryable class from Automapper

Does Automapper works with IQueryable?
I have 2 Query
IQueryable<V_ImageUpload> Query1;
IQueryable<V_ImageUpload> Query2;
Mapper.CreateMap<IQueryable<V_ImageUpload_WithReceiptBackup>, IQueryable<V_ImageUpload>>();
Query1 = Mapper.Map<IQueryable<V_ImageUpload_WithReceiptBackup>, IQueryable<V_ImageUpload>>(Query2);
Exception occured is:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary
I've not used AutoMapper (so this was an excuse to try it out!), but there are queryable extensions available. Both your queryables are of the same type, so I'm not exactly sure what you are trying to achieve, but perhaps something like this is what you want, which takes an IQueryable<V_ImageUpload_WithReceiptBackup> and converts it to an IQueryable<V_ImageUpload>:
IQueryable<V_ImageUpload_WithReceiptBackup> query1;
IQueryable<V_ImageUpload> query2;
// Only map the actual type, not the queryable types
Mapper.CreateMap<V_ImageUpload_WithReceiptBackup, V_ImageUpload>();
query2 = query1.Project().To<V_ImageUpload>();
The .Project().To<V_ImageUpload>() keeps it as IQueryable, while Mapper.Map would end up with a List/IEnumerable. I only tested this out with LINQ to Objects, but hopefully it works with Entity Framework, or whatever you are using.

Kohana 3.3 ORM - Database Views

Is there a way to use the orm factory to pull from a view instead of a table? I was hoping that the syntax would be equivalent to pulling from a table:
$buyers = ORM::factory('vbuyer'); //where vbuyers is the name of the view
This results in the error : ErrorException [ Fatal Error ]: Class 'Model_Vbuyer' not found
Unfortunately that doesn't seem to work. Can I have the orm map a view to a model, or do I have to use the DB::select('*')->from('vbuyers') approach?
EDIT: The problem was actually that the filename of the vbuyer model was incorrect, it had an underscore v_buyer. Removed the underscore and it worked.
EDIT: To answer the original question - yes, you can use the ORM factory to generate models based on database views. The problem in this case was unrelated, see above.

Using constructor to load data in subsonic3?

I'm getting an error while trying to load an record through the constructor.
The constructor is:
public Document(Expression<Func<Document,bool>> expression);
and i try to load a single item in like this
var x = new Document(f=>f.publicationnumber=="xxx");
publicationnumber isn't a key but tried making an it an unique key and still no go..
Am i totally wrong regarding the use of the constructor? and can someone please tell me how to use that constructor?
The error i'm getting is:
Test method TestProject1.UnitTest1.ParseFileNameTwoProductSingleLanguage threw exception: System.NullReferenceException:
with the following stacktrace:
SubSonic.Query.SqlQuery.Where[T](Expression1` expression)
Load`[T]`(T item, Expression1expression)
db.Document..ctor(Expression``1 expression) in C:\#Projects\DocumentsSearchAndAdmin\DocumentsSearchAndAdmin\Generated\ActiveRecord.cs: line 5613
rest removed for simplicity
Regards
Dennis
Use == instead of =, i.e.:
...(f=>f.publicationnumber == "xxx");
I've just gotten the SubSonic source, and found out that it had to with the expression parser and my lack of knowledge thereof .. my right side of the expression was actually an item in an string array - and s[PUBNO] (PUBNO is a const) and it was looking for an column named s instead of publicationnumber, i don't know if this i a bug or not in the linq classes
none the less - i've managed to get it to work by creating a local variable containing the value of s[PUBNO] and using that instead...
//dennis

Resources