Cloudant Geospatial query - geospatial

I'm new to cloudant, i want to fetch records by lat and long with particular category.
//This is getting records by Lat and Long
dbname/_design/ad/_geo/geoidx?lat=29.2609417&lon=71.1750101&radius=100
but i want to fetch records by particular category something like this...
dbname/_design/ad/_geo/geoidx?lat=22.2609417&lon=73.1750101&radius=100&item_type_id: '12345'
how can i achieve this? please reply...
Thanks..

You can't achieve this using the Cloudant Geo index. You need to use Cloudant Search (powered by Lucene Geo), which allows you to combine a radius search with attribute search. Here's a tutorial: https://developer.ibm.com/clouddataservices/2016/01/07/geospatial-query-with-cloudant-search/
The only caveat is with Cloudant Search you can only do bounding box and radius searches -- no polygon searches.

Related

Id like to search cloudant by words and a range of timestamped dates via node-red

My cloudant database was created with the following: msg.payload via tweetnode to cloudant
{
"timestamp" : msg.tweet.timestamp_ms,
"tweet" : msg.tweet.text,
"sentiment" : msg.sentiment.score
}
I would like to search the tweets by word and a range of dates. Then save the results by tagging the tweets found back to cloudant via node-red.
This seems like a routine thing people do. I have not found any flows that do this. Any help is appreciated
Your index look right. Maybe the 404 was caused by the white spaces you have around the colon. Here a quick example: https://gist.github.com/lgfa29/d965e66bf1ffa0fff7ab26f314ea98de
You can copy this JSON document, click on the three dashes in the top right of the Node-RED editor and select Import > Clipboard. Then just paste the JSON content there and drop the nodes somewhere. You will also need to update the Cloudant node to point to your database and search index.
To query using search indexes you can use the Lucene query syntax, so to search for a range you would do something like timestamp:[1551464030329 TO 1551465568517]
Here is a sample I deployed: https://node-red-pet-dev.mybluemix.net/search?from=0&to=1651464030328&tweet=zebra* (sorry, my tweets are not very imaginative)

Simple query search - OrientDB

I'm new in graph database - OrientDB.
I have a problem to search vertex connected to other vertex with specific edge.
For example:
I have a database - MovieRatings (public database OrientDB). I want search only Adventure type of movies.
How can I do it?
Thank you for your answer.
Try this:
select from Movies where out("hasGenera").description contains "Adventure"
Hope it helps
Regards

Cloudant - apply a view/mapReduce to a geospatial query

HI I'm new to cloudant (and couch and asking questions on stackoverflow so I hope I manage to be vaguely clear about what I'm asking ) and I'm trying to do probably the second most basic geo task but am hitting a dead end.
I've got a database of docs which are geojson objects, I've created an index so I can query for intersections etc but it seems the only options I have in the url is the format=legacy (gives me the ids) and the format=geojson and the include_docs parameter - what I'd like to do is give back a particular view of the result set - I'm not interested in the geometry of the object (which is a big lump of data and it's likely that a number of other properties may be in the document that I'd rather filter out)
is there a correct way to do this in a single api call or do I need to fetch the doc ids (legacy format) and then issue a second query to bring back my chosen 'view' for each document id given in the result of format=legacy response
Thanks

Force document(s) into SOLR search results

Is there a way to force specific documents into SOLR search results?
I'm trying something like this but is not working:
/q=id:21321 OR myNormalSearchConditionsHereIncludingDismaxQUery
My goal is to have certain documents always show up in some search results, no matter what the query is.
you can use Solr MoreLikeThis component
This is just a quick thought i would make from your description.
With this you will no longer require a second query and caching the results.

Is there any way to search through CouchDB documents for substring

CouchDB gives an opportunity to search values from startkey, for exact key-value pair etc
But is there any way to search for substring in specified field?
The problem is like this. Our news database consists of about 40,000 news documents. Say, they have title, content and url fields. We want to find news documents which have "restaurant" in their title. Is there any way to do it?
View Collation wiki page tells nothing :( And it seems strange to me that there's no tool to handle this problem and all I can to do is just parsing JSON results with Python, PHP or smth else. In MySQL it's simply LOCATE() function..
Use couchdb-lucene.
Be careful here. Lucene is not always the best answer.
If your only searching one limited field and only searching for a word like restaurant then lucene which is really meant to tokenize large texts/documents can be way overkill, you can get the same effect by splitting the title.
function(doc){
var stringarray = doc.title.split(" ");
for(var idx in stringarray)
emit(stringarray[idx],doc);
}
Also Lucene and Couchdb do not support substring search, where the string is not in the beginning of a word.

Resources