I may be missing something completely obvious, but if I try a twitter search for "bear" "paddington" OR "station" "paddington", like so:
https://twitter.com/search?q=bear%20paddington%20OR%20station%20paddington&src=typd
I only get results for Paddington bear.
Strangely enough, if I switch the terms in each clause:
https://twitter.com/search?q=paddington%20bear%20OR%20paddington%20station&src=typd
I only get results for Paddington station (?!).
I'm seeing the same when submitting these queries using the REST API.
What I'm looking for is tweets with
(paddington AND bear) OR (paddington AND station)
Is this even possible?
Your search term is essentially searching for bear AND (paddington OR station) AND paddington so you will get the results you are seeing.
What you are trying to search for is paddington AND (bear OR station) so https://twitter.com/search?q=paddington%20bear%20OR%20station&src=typd should achieve that
Related
I would like to get all documents that contain a certain string in them, I can't seem to find a solution for it..
for example I have the following doc ids
vw_10
vw_11
bmw_12
vw_13
bmw_14
volvo_15
vw_16
how can I get allDocs with the string vw_ "in" it?
Use batch fetch API:
db.allDocs({startkey: "vm_", endkey: "vm_\ufff0"})
Note: \ufff0 is the highest Unicode character which is used as sentinel to specify ranges for ordered strings.
You can use PouchDB find plugin API which is way more sophisticated than allDocs IMO for querying. With the PouchDB find plugin, there is a regex search operator which will allow you do exactly this.
db.find({selector: {name: {$regext: '/vw_'}}});
It's in BETA at the time of writing but we are about to ship a production app with it. That's how stable it has been so far. See https://github.com/nolanlawson/pouchdb-find for more on Pouch Db Find
You better have a view with the key you want to search. This ensures that the key is indexed. Otherwise, the search might be too slow.
I am using solr for searching. I wants to improve my search result quality based on previously searched terms. Suppose, I have two products in my index with names 'Jewelry Crystal'(say it belongs to Group 1) & 'Compound Crystal'(say it belongs to Group 2). Now, if we query for 'Crystal', then both the products will come.
Let say, if I had previously searched for 'Jewelry Ornament', then I searches for 'Crystal', then I expects that only one result ('Jewelry Crystal') should come. There is no point of showing 'Compound Crystal' product to any person looking for jewelry type product.
Is there any way in SOLR to honour this kind of behavior or is there any other method to achieve this.
First of all, there's nothing built-in in Solr to achive this. What you need for this is some kind of user session, which is not supported by Solr, or a client side storage like a cookie or something for the preceding query.
But to achive the upvote you can use a runtime Boost Query.
Assuming you're using the edismax QueryParser, you can add the following to your Solr query:
q=Crystal&boost=bq:(Jewelry Ornament)
See http://wiki.apache.org/solr/ExtendedDisMax#bq_.28Boost_Query.29
How do I get the most popular tags from Instagram API? I searched the API, but didn't find a way to retrieve this data. This website gets it, but how?
The question is old, but for others also struggling the same problem, as Sebastien mentioned there is no such query. However I have been recently needing same functionality and came down idea that small traversal pretty much solves the problem.
Instagram doesn't respond you a list of tags starting with just one letter.
Example:
https://api.instagram.com/v1/tags/search?q=a
This URL returns just one element, which is "a". However if you send a request containing two characters like
https://api.instagram.com/v1/tags/search?q=aa
then you'll end up with the most popular tags starting on "aa"
Afterwards you can simply traverse your desired alphabet in O(N^2) time and by joining responses you'll end up with a list of most popular tags.
Length in case of English(Latin) alphabet would be 26^2 = 676
Though you shouldn't probably try getting any more tags as the limit is still 5,000 requests and 26^3 would go for 17576.
foreach(character in 'a'...'
{
foreach(character in 'a'...'z')
{
Send hashtag request 'aa'...'az'...'zz'
Get json and merge with previous array
}
}
Sort final array by [media_count]
Alternate approach would be to parse some huge dictionary (wikipedia dump for example) and sort out top 5000 most common prefixes and try querying them.
I don't think the API supports that query. What you can do is check this popular media endpoint and deduce popular tags from there:
http://instagram.com/developer/endpoints/media/#get_media_popular
The website you mention could be using multiple Real-time subscriptions and generate that list of popular tags by consolidatingthe harvested information. That wouldbe my guess.
I think the best thing is to ask them directly.
I am indexing the title field for few products in Solr.
But when I am searching, I am not getting those titles in response.
For eg. I am storing following as title : Baboons Typing Tshirt
But when I am searching following I am not getting any result !!!
1)title:Baboons
2)title:(Baboons Typing Tshirt)
3)title:(Baboons*)
On the otherhand, if I am searching like this, I am getting lot of results
1)title:(Tshirt)
I have indexed many titles containing word Tshirt but I want to search a specific title which is failing..!!
I dont know whether Solr is ignoring first words, or it is doing something random.
My Question is basically: If I have a search title with lots of words, I will like to match it with the title which contains maximum common terms.
How to do it?
Thanks
Solr works like that by itself. You don't have to change anything.
You have to be careful how you set up your fields in schema.xml, i.e. how analysis is done.
You can use Solr's admin > Analysis interface to see how exactly your title field (when indexing) and query (when searching) is processed (tokenized, transformed).
Remember, match, in order to occur, requires identical word (case and everything) on both sides (index & query).
To open your index and see how Solr has actually indexed your data, use Luke.
Some popular words, like "food," are used all over the world as loan words.
I am trying to use flickr.photos.search to get photos from one specific language or region.
I didn't find a setting for this in http://www.flickr.com/services/api/flickr.photos.search.html
I tried these two ways, but neither worked:
http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=XXXXXXXXXX&tags=food&format=json&location=japan
//lang=jp
I searched in Google and only found that YQL can search by location. (I will use YQL in another way, too many calls will over the api will be limited.)
I also found that in flickr.photos.search one can set a lat, lon, and radius, but the range is a circle, so this will not limit a search to a specific country.
None of these are good choices for me. Can anyone help?
There are actually a few interesting ways to do this.
The way I would do it is to first find the place you are looking for by using the place API:
flickr.places.find: http://www.flickr.com/services/api/flickr.places.find.html This will return a list of WOE (Where on Earth) ids for a given query. Your query can be anything from a street address to a country.
Once you have the WOE id, you could then submit a flickr.photos.search query including the optional place_id or WOE id.
Another fun way to do this would be to call the flickr.places.tagsForPlace method once you have a WOE id, and then search for your photos by these tags. This might produce more interesting results and also weed out the users who didnt specify a place, but did specify tags.