https://graph.facebook.com/search?q=mark&type=user&access_token=2227470867|2.AQDzzvizJdnQFGlQ.3600.1315422000.0-100002485550696|SUNASlYr-pHh7ooE2c_omSxIhbU <---- returns all users with the name mark.
How can I do the opposite? How can I EXCLUDE all users named Mark?
I tried q!= and q<> but that did't work.
Thanks...
I don't think it's possible. You will have to run the filter after you get the results.
Related
is there a way to use _score to filter the cloud search results? I am trying to refine the output in order to show only relevant results.
I wanted to do something like
(and ( or ii_disponivel:1)(or range field=_score{10,}))
Score is only on query not on filters. Also explore about function_score. That might help. I can’t comment more on function_score as I too haven’t used it yet.
I have a sheet with multiple links, all in the format of https://abc.xyz.com/randomstuff and I would like to remove the abc. from all of them.
Is there a way to somehow automate that for me inside google sheets?
try:
=ARRAYFORMULA(IFERROR(REGEXEXTRACT(A6:A16, "(https?://)")&
REGEXEXTRACT(A6:A16, "[^\.]\.+(.+)")))
You can do that with Substitute():
=SUBSTITUTE(A1,"abc.","")
Or even use Arrayformula() to apply the formula to a range of values:
=ARRAYFORMULA(SUBSTITUTE(A1:A,"abc.",""))
I was trying to get a list of all the fields in all the tables in Access 2007. I tried a bunch of macro suggestions I found, but none of them worked, does anyone have an idea?
You could make a DAO-Connection to CurrentDb and Loop through the TableDefs-Object to get all tables. The use the Fields-Collection.
I've put together a simple search form, with a search box and a couple of filters as dropdowns. Everything works as you'd expect, except that I want the behavior to be that when the user leaves everything completely blank (no search query, no filters) they simply get everything returned (paginated of course).
I'm currently achieving this by detecting this special case and querying my local database, but there are some advantages to doing it 100% with CloudSearch. Is there a way to build a request that simply returns a paginated list of every document? In other words, is there a CloudSearch equivalent to "SELECT id FROM x LIMIT n?"
Thanks in advance!
Joe
See the Search API.
?q=matchall&q.parser=structured will match all the documents.
These easiest way would be to use a not operator, so for example:
?q=dog|-dog
would return all documents that contained 'dog' and also did not contain 'dog'. You would need to intercept the special case, as you are already, and just substitute a query/not query combo and you should get everything back.
For someone looking for an answer using boto3.
CLOUD_SEARCH_CLIENT = boto3.client(
'cloudsearchdomain',
aws_access_key_id='',
aws_secret_access_key='',
region_name='',
endpoint_url="https://search-your-endpoint-url.amazonaws.com"
)
response = CLOUD_SEARCH_CLIENT.search(
query="matchall",
queryParser='structured'
)
print(response)
How can one write an alias for the column name in django query set.
Would be useful for union-style combinations of two linked field to the same foreign model (for instance).
for example in mysql :
select m as n, b as a from xyz
how can i do this in django query set ?
models.Table.objects.all().values('m', 'b')
Any help really appreciate it.
You can annotate the fields as you want, with the F expression:
from django.db.models import F
models.Table.objects.all().values('m', 'b').annotate(n=F('m'), a=F('b'))
Although this could have been done before by using extra(select={'n':'m','a':'b'}), I agree that this really should have been a part of values() itself.
To that end, and inspired by Alex's ticket, I have just posted a patch that adds this feature. I hope you'll find it useful!
Your reason in the comment makes no sense. Each field in the model has its own column in the database, and there's never any danger of mixing them up. You can of course tell a field to use a column name that's different from the field name:
myfield = models.CharField(max_length=10, db_column='differentname')
but I don't know if that will help you, because I still don't know what your problem is.
I'm presuming this isn't possible, so I've raised a ticket for the feature to be added, I think there is some merit to being able to do this. Please see the ticket for more information.
https://code.djangoproject.com/ticket/16735
you can also use .alias() in your queryset.
.alias(alias=SomeExpression()).annotate(
SomeOtherExpression('alias'))
.alias(alias=SomeExpression()).order_by('alias')
.alias(alias=SomeExpression()).update(field=F('alias'))
for your specific case, this would be the answer
models.Table.objects.all().alias(
n=F('m'), a=F('b')).values('m', 'a')
)
I really can't understand what you are trying to do however it sounds like what you are looking for is the extra queryset method. This for most purposes acts in the same manner as AS does in sql.