How to do a search by date query on cq pages - aem

I am trying to create a blog in cq5. The OOTB search component in blog is not supporting search by date feature. I tried to override it, but could not find the correct query to fetch the blogs created on a particular date. Seems the only functions supported are >,>=,<,<=.
Please help me in finding a query (preferabbly xpath) to fetch a page created on a particular date (cq:lastModified).

There are some functions in XPath like contains or not. There is also one for date fields. Here an example for anything that was just modified in the content tree:
/jcr:root/content//*[#cq:lastModified >= xs:dateTime('2015-05-29T08:44:56.280Z')]

Related

AEM 6.2:: Search cq:Page and dam:Asset with a specific tag and ordered by jcr:created

I am trying to create PredicateGroup that would search all cq:Page and dam:Asset under respective paths. Further, these nodes are tagged with a specific tag and ordered by jcr:created.
Here is what I have written:
group.1_group.p.and=true
group.1_group.path=/content/some/path
group.1_group.type=cq:Page
group.1_group.1_property=#jcr:content/cq:tags
group.1_group.1_property.value=root:some/tag
group.p.or=true
group.2_group.p.and=true
group.2_group.path=/content/dam/some/path
group.2_group.type=dam:Asset
group.2_group.1_property=#jcr:content/metadata/cq:tags
group.2_group.1_property.value=root:some/tag
and it won't work on query debugger. I have also looked at this URL Search DAM assets and Cq pages using lastModified date | QueryBuilder and I don't know what I am doing wrong. Right now, I haven't added the condition for sorting because I was trying to go step by step.
Thanks in advance

Retrieve the newly added comments from Facebook

Giving a PostId i'm trying to retrieve all the comments attached to this post by using the graphApi. Its simple to retrieve the comments for the first time, i just keep following the next link in the paging propertie of the api response.
But to keep this list of comments up to date i need to retrieve the newly added comments. I tried using the cursor After (stored from the last retrieved page) but it's not working as expected, using the parameter since in the query doesn't work either (seems that it is not supported by the endpoints /comments).
Can please someone gives me an alternative solution?
As i said 'since' is not supported by the endpoint '/comments' because the api use cursors for the pagination (next, after and befor fields).
The use of the cursor 'after' will not work neither, because the its value is valide for a short period of time (docs link)
So my solution was to use an ordred query to get the comments
https://graph.facebook.com/v2.6/[post-id]/comments/&filter=stream&order=reverse_chronological
, i save the created_timeof the first comment as last_update_time. Then the next time i execute my code i check for each comment the time when it has been created if it's grater than the last update time i save it
while (comment.created_time > last_update_time):
comments_list.add(comment)
comment = comments.next()
if (len(comments_list)>0):
last_update_time = comments_list[0].created_time

How to delete only a subset of posted data in firebase

Posting data to firebase generate new items similar to the following example:
log
-K4JVL1PZUpMc0r0xYcw
-K4jVRhOeL7fH6CoNNI8
-K4Jw0Uo0gUcxZ74MWBO
I struggle to find how to e.g. delete entries that is older than x days - preferably with the REST API. Suggestions appreciated.
You can do a range query.
This technique requires you to have a timestamp property for each record.
Using orderBy and endAt you can retrieve all of the items before a specified date.
curl https://<my-firebase-app>.firebaseio.com/category/.json?orderBy="timestamp"&endAt=1449754918067
Then with the result, you can delete each individual item.

Instagram Search for a tag within particular date range

I am looking to retrieve results from instagram for a particular tag mytag , I tried using this API call,
https://api.instagram.com/v1/tags/{tag-name}/media/recent
but it only returned 33 results even though there are more results. This question can be considered an extension to this question: How To Search Instagram via API Query?
What is the way to return instagram results for a particular tag within a date range?
This may be done through the min_tag_id and max_tag_id which. Not sure how to convert my date time to min_tag_id or max_tag_id?
call the API with max_tag_id and min_tag_id like this:
https://api.instagram.com/v1/tags/{tag-name}/media/recent?client_id={CLIENT_ID}&max_tag_id=1378677250000000&min_tag_id=1375998850000000
max_tag_id and min_tag_id is epoch_time + "000000"
you still only get 20 per API call, use pagination to get all
Update: Instagram changed the tag_id, so date filter cannot be done
this way. Login on http://gramfeed.com and search for a hashtag and
you can do date/time filter, its a different hack implementation.

Search pages with a Tag in CQ5

I am working on a custom search component in CQ5. I need to search for 1 or more tags selected by user using checkboxes. I tried using an earlier query to search text (select * from cq:Pagecontent where...)
I tried using :
select * from cq:PageContent where cq:tags like '%mytag%'
but it is not working. There are 2 pages which have 'mytag' as tag.
Any suggestion on how to do it ?
The following query is working for me. I'm searching here for for the following tags marketing:interest/services and marketing:interest/product
//element(*,cq:PageContent)[#cq:tags='marketing:interest/services' or #cq:tags='marketing:interest/product']
At the moment I would still go for XPATH, because of the better performance then SQL2.
When searching for a tag I also would avoid wildcards as they are not necessary if you are searching for an exact tagname.
Wildcards can negatively influence the performance of your query.