I'm an ArangoDB beginner and am trying to implement an inheritance hierarchy in documents - might end up being a car crash! Anyway I'm a little stuck. For example, if I had a number of documents like {type: animal.person} and {type: animal.dog} how would I find all documents with a type that startsWith animal in AQL?
I've tried to filter on 'type LIKE animal%' but it's slow.
I've tried to filter on 'CONTAINS(type, animal)' which is faster but guess that if for some reason I ever had a document like {type: xxx.animal.person} it would hit on that too. Also, the CONTAINS doesn't use an index.
I've also read a lot about skiplist indexes and using something like 'type >= animal' and 'type < animal' but for the life of me I can't figure it out - especially because of the dot!
Any help would be fantastic!
Related
it seems to be an issue / bad configuration in my solr index.
In detail when I perform a search by using some words in my query the solr result is ok, it returns me 50 entries.
Let me show an example :
Example 1)
url = http://mydomain:8983/solr/mycore/select?q=walk%20in%20the%20city
query = walk in the city
results = 231373, 231372, 231454, ....
Unfortunately when I use a single word in my query the solr result is "truncated"
Let me show some examples :
Example 2)
url = http://mydomain:8983/solr/mycore/select?q=Walk
query = Walk
results = 231373, 231372
Example 3)
url = http://mydomain:8983/solr/mycore/select?q=city
query = city
results = 231373, 231372
As you can see "Walk" and "city" words are inside my first query set.
The results in examples 2/3 are the same.
I'm a beginner in using solr, probably I perform some mistakes in solr configuration.
What I have to check first in order to optimize the query?
Thanks in advance.
Best regards.
Sergio
I would suggest to add debugQuery=true to your query and look at the debug node in the result. Under debug in particular look at the parsedquery to see what Solr is doing with your query, like what fields it's searching and whether it is using AND or OR between expressions (e.g. +fieldName means AND).
Also, under the debug there is an explain node that contains the documents that were found and why they were found. That should help you pin point why those records were returned. The explain output is pretty convoluted, but there is a lot of useful information there for this kind of issues.
(I realize this is not quite an answer to your question, but it's too long for a comment.)
I have a very simple collection of 9 documents if I do this:
db.products.find({"Description": /.*m.*/}).count()
it returns 3.
In node.js I have this:
db.collection("products").find({Description: new RegExp(`/.*${request.query.name}.*/`)});
It behaves exactly as if I do:
db.collection("products").find({Description: new RegExp(request.query.name})});
I mean. I have to write an entire word to get results back. I should note that I have a $text index in the Description field and it is the only $text index in the collection.
The retrieve is very fast but... since I am using it in a autocomplete I was hopping to be able to write just one letter to start getting results. I project fields so the data returned is not too big. It works on the mongo console but it seems I am missing something in how Regex works in Javascript.
Many Thanks in advance.
Edit
Following: MongoDB Regular Expression Search - Starts with using javascript driver and NodeJS I have tried:
db.collection("products").find({Description: {'$regex': request.query.name}});
with no avail. I still need to type a complete word. I insist that with a regex with a contains a letter works in the mongo shell.
I am really lost here. Any help would be really appreciated.
I think you have to use the $options property here. Like this:
db.collection("products").find({ Description: { '$regex': request.query.name, $options: 'is' }
});
i
- For case insensitivity.
s
- Will allow dot character to match all characters, and newline characters.
You can check more of this MongoDB $regex.
I hope this helps.
I'm trying to create a Parallel Coordinate graph with a csv file I have. The graph I'm trying to make looks like the image I have drawn here -> DrawnGraph. The issue I am having is that the countries are listed individually on the csv file. I need to create a code that places the countries within their corresponding continents. I attempted the code below but I keep getting "The operator || is undefined for the argument type(s) boolean, String"
I realize that I am typing it wrong but I do not know how to fix it. Help please
if(Country.equals("Aruba")||Country.equals("Argentina")||Country.equals("Bolivia")||Country.equals("Brazil")||Country.equals("Chile")||("Columbia")||Country.equals("Ecuador")||Country.equals("Guyana")||Country.equals("Paraguay")||Country.equals("Peru")||Country.equals("Suriname")||Country.equals("Uruguay")||Country.equals("Venezuela"))
Looks like you're missing an occurrence of Country.equals here:
Country.equals("Chile")||("Columbia")||Country.equals("Ecuador")
Add that in and it ought to work.
By the way, you haven't specified what programming language you're using. You probably should.
For a simple project in Java I would need a library that from a given words it returns me a list of its declinaison (including plural, singular, adjective etc..)
As an example something like this:
"Photo" -> "Photo", "Photograph", photography"
"Walks" -> "Walk", "Walking" ...
I had a look at lib like CoreNLP but I cannot figure out how to achieve this kind of stuff? Plus the doc is kind of bad and I cannot hardly find any nice code example.
Could someone help with this?
I'm trying to use IxSet for database-like purposes, so I've built an index of items and I need to do exact match on some field.
Query operator (#=) http://hackage.haskell.org/packages/archive/ixset/1.0.2/doc/html/Data-IxSet.html#v:-64--61- returns an IxSet a type, but I need only to either get 1 or 0 results. To check if it's 0 results, I do null items on that, but how do I get first item?
Due to description of IxSet type http://hackage.haskell.org/packages/archive/ixset/1.0.5/doc/html/Data-IxSet.html#t:IxSet I don't see any typeclass that has operation like head or fst.
Ok, found an answer. You should use some available function like getOne http://hackage.haskell.org/packages/archive/ixset/1.0.5/doc/html/Data-IxSet.html#v:getOne , for example.
p.s.: I find that a bit strange to first create your type from list of items and then add operations that duplicate list-operations, but maybe I'm just newbie :)