I want to search for all popular tweets with language german. I tried the following query (q=* is encoded as q=%2A)
GET https://api.twitter.com/1.1/search/tweets.json?q=%2A&lang=de&result_type=popular&with_twitter_user_id=true&include_entities=true
This seems to return results, but
I have found no documentation that twitter search api supports wildcards. So I'm not sure if the results returned by that query are the one I want. I only found this example from the documentation at https://dev.twitter.com/rest/public/search
https://api.twitter.com/1.1/search/tweets.json?q=&geocode=-22.912214,-43.230182,1km&lang=pt&result_type=recent
which seems to imply that one has to use an empty query string q= instead of a wildcard. However if I try
GET https://api.twitter.com/1.1/search/tweets.json?q=&lang=de&result_type=popular&with_twitter_user_id=true&include_entities=true
I do get an error "Query parameters are missing".
So how can I search for all popular tweets with language german if a wildcard (q=*) are not supported and an empty query (q=) is also not allowed?
You can use a query string such as this to search all tweets which use roman alphabet languages:
e OR t OR n OR o OR a OR i OR r OR s OR h OR l OR d OR c OR f OR u OR m OR y OR g OR p OR b OR v OR w OR k OR q OR j OR x OR z OR 0 OR 1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9
Note I have not tested to see if rich media-only tweets, such as videos or images with no captions, are included in the results.
Related
I am trying to create a search function where users are able to select from a list in Google Sheets and the below query function will return that data that corresponds from the users' selections.
=query(Overview!A:AF,"SELECT D,I,M,AA WHERE AA = '"B27"' AND L ">=" "&E27&" AND S CONTAINS '"&H27&"'",1)
I expected to get the list (D, I, M, AA) but I keep getting #ERROR, what is the problem?
this is the correct syntax:
=QUERY(Overview!A:AF; "SELECT D,I,M,AA
WHERE AA = '"&B27&"'
AND L >= '"&E27&"'
AND S CONTAINS '"&H27&"'"; 1)
I'm using neo4j 3.5, and have about 9 million user nodes. I was trying to implement the following query, but it was taking way too long:
MATCH (users:User) WHERE (users.username CONTAINS "joe" OR users.first_name CONTAINS "joe" OR users.last_name CONTAINS "joe")
RETURN users
LIMIT 30
I was hoping to take advantage of neo4j 3.5's newe fulltext indexing feature by creating the following index:
CALL db.index.fulltext.createNodeIndex('users', ['User'], ['username', 'first_name', 'last_name'])
and then querying the db like so
CALL db.index.fulltext.queryNodes('users', joe)
YIELD node
RETURN node.user_id
I thought this would work the same as contains and return users whose username, first_name or last_name contains joe (eg: myjoe12, joe12, 12joe, 44joeseph, etc.) but it seems to be returning users whose fields are joe exactly or contain joe separated by a whitespace (eg: Joe B, Joe y1), I tried using joe* in the query but that only returns everything starting with joe, I want to return everything containing joe or whatever search term. What would be the best way to go about this?
Speed issue / Index:
So far I know, Neo4j has a optimised index for STARTS WITH & ENDS WITH only for NOT composite indexes.
If I read this docs paragraph, my conclusion will be this: Your 9 million users will be searched one by one, neo4j doesn't use any index for your query. What makes this query really slow.
A answer to your question:
I want to return everything containing Joe or whatever search term.
You probably looking for a regex search (this is also slow and not a index search and not recommended):
Example query based on your query:
MATCH (users:User)
WHERE (users.username =~ "(?i).*joe.*" OR users.first_name =~ "(?i).*joe.*" OR users.last_name =~ "(?i).*joe.*")
RETURN users
LIMIT 30
Explanation for (?i) this means case-insensitive so Joe or joe will be matched. See regex operator docs and regex where docs
For the fulltext schema index, it looks like you'll need to use the fuzzy search operator ~ in your query, though you may need to do some filtering on the score to make sure you're looking at relevant results:
CALL db.index.fulltext.queryNodes('users', 'joe~')
YIELD node, score
WHERE score > .8
RETURN node.user_id
I am trying to match this string:
NFPA 101 19.7.2.2
and am using this regex:
(NFPA) (\w+)(?: ?(?:([^.]+)\.?)+)?
This seems to match the string, but the captured groups are not what I'm looking for. I expect:
NFPA
101
19
7
2
2
What I get is this:
NFPA
101
2
See this rubular example:
http://rubular.com/r/43VY0yyNa7
It's as if that last recurring capture group is being overwritten by the final match. Is there a way to have all of these come back as capture groups as I need?
Added another regex that gives me the similar problem described above:
(NFPA) (.+) (.+?.)+(.+)
The issue is you're using non-capturing group symbol : which isn't gonna work to select the string as separate capture group. To overcome the issue you need to use Positive / Negative Lookahead. So, the following regex should work in this case :
(\w+|\d+[-]\d+)(?=\s?)(?![-])
see demo
My data set is quite complex, but to simplify what I want, I can say that I have a set of discussions that are labeled with date and time and each discussion has a topic assigned. I am trying to find patterns: if topic 1 appears, what is it usually followed by? I am observing daily trends. I currently have the following query:
MATCH (start:Label1)
WHERE start.topic = Topic1
WITH start
MATCH (start)-[r:FOLLOWED_BY]->(end:Label2)
WITH count(end) as ecount, r as rel, collect(end.topic) as topic
RETURN DISTINCT(r.day) AS day, topic, sum(ecount) ORDER BY day DESC;
Which returns:
250 Topic1 2
250 Topic2 1
250 Topic3 3
While I want the following:
250 Topic1[2] Topic2[1] Topic3[3]
How do I achieve this? I tried to use collect and I get an error along the lines: don't know how to compare that.
It's a bit hard to say without seeing the collect that you tried, but what about this?
MATCH (start:Label1 {topic: Topic1})-[r:FOLLOWED_BY]->(end:Label2)
WITH count(end) as ecount, r as tel, collect(end.topic) as topics
UNWIND topics AS topic
RETURN DISTINCT(r.day) AS day, collect(topic + "[" + sum(ecount) + "]")
ORDER BY day DESC;
For some queries with documentlist api (and also within UI) I get different results for this queries:
1. "single_word"
2. single_word
For example for this:
"mody" - I receive 69 results
mody - I receive >200 results (many of them don't contains this word)
(This happens also for combination of words that contains this word. For example:
**"mody" company** and **mody company** returns different results)
Which is the difference between this searches? And how it is recommanded to search for best exact matches results? I don't want to receive results that contains only mod (for example) words.
"mody" matches tokens exactly with only the characters m-o-d-y, and whitespace on either side. It only matches mody.
mody matches tokens containing the characters m-o-d-y. It would match mymody, mody, asdfmody, modyasdf, etc.