Jhipster Elasticsearch between dates - jhipster

Does anybody can help me to find a date field in my Entity?
I set a start date and a final date and I need to find the date between that range. I'm using a Jhipster application with ElasticSearch.
It has to query the database.
Thank you.

JHipster's generated search method uses a Query String Query, so you can send a query to your application's API that looks like this: query: 'dateField:[2000-01-01 TO 2000-01-02]'.
Source: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

Related

Get last modified date

Can I know the date when was my collection (or collections) in MongoDB were modified using mongoose? I did research and I did not find any resources that would answer my question so looking for help. Thanks in advance
if you add timestamps to your collection config, it'll track the date of your change with a property called updatedAt. refer to the doc

Search exact text in a string

I am querying a SQL Server DB. I have a field "Remarks" that contains values pipe delimited as such
59P|W26|W511|862|W51
I'm trying to search in this field for an exact match, for example in the above I just want to return W51 not W511. I thought contains would help but unfortunately the table is not full text indexed and I dont have the ability to change that. Any suggestions?
It looks like you can do this using sql server because it has a useful built in function. Check out https://www.sqlservertutorial.net/sql-server-string-functions/sql-server-string_split-function/

Google Search Appliance querying date meta field with given range

I want to send a query to the Google Search Appliance that includes date range criteria of a meta field (lets call it metaDate). For example: metaDate field between 01.01.2010 and 01.01.2015. How can i construct a query such like this?
Mohan's not entirely correct. You can perform range searches on any metadata attribute. This is different then the document date. See Google's Documentation for this.
Also you can create a dynamic navigation element and test the format yourself. Dynamic Navigation can be used to construct range searches.
You have to tell GSA to use metaDate as Lastmodifieddate either by adding it as Last-Modified response header or by configuring Document Dates in GSA admin console for metaDate. After the changes, reindex your documents and fire a date range query along with the query term.
For example, q=someterm daterange:2010-01-01..2015-01-01

Orchard CMS Query Creation Date

I'm new to Orchard CMS and trying to create a query that will filter a list of upcoming events date. What I want to do is filter a list of upcoming events. I have set up a list and plan to use the creation date (setting the date to the event date) as filter. Where I have ran into an issue is getting the filter value to work. When I set the filter value to {DateTimeField.Date} for get the current date or any of the other date options, the filter does not work. It show all events. When I manually type in the value field "2014-08-20", it works. Any ideas of why I can not set the date to the current date?
I have also tried creating just a date field within the content definition and received the same issue as above. I do plan to create a Event End Date that will not show, but will be used to filter. I assume the value will be very similar though to what would be needed for the creation date though.
I am using Orchard CMS 1.8.0
Any help will be greatly appreciated.
The current date can be obtained in Token form like this: {Date}. That token itself can be modified as a date token. In particular, it can be formatted. In your case, because the filter will construct a HQL filtering clause from your expression, {Date.Format:yyyy-MM-dd} will put the current date into the right format.

Caml query to fetch data from Sharepoint list for a specific Date

I have a sharepoint list with one of hte columns being Created Date of Type DateTime and value allowed is OnlyDate.
The submitted date in my column is 05/18/2011. When I perform a search using the below CAML query, it does not give any results though I have two items with this date.
<Where><Eq><FieldRef Name='Date_x0020_Created' /><Value Type='DateTime'>5/18/2011</Value></Eq></Where>
I dont understand what is wrong with this query. Someone please help.
Sharepoint accepts datetime in ISO 8601 Datetime form in UTC. The format is
yyyy-MM-ddTHH:mm:ssZ
So for your example you can use
2011-05-18T00:00:00Z
SPUtility does provide a method to do this conversion.
For creating this in Java you can use the following method:
private String changeDateToISO8601(Date date) {
TimeZone timeZone = TimeZone.getTimeZone("UTC");
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
dateFormat.setTimeZone(timeZone);
String convertedDate = dateFormat.format(date);
return convertedDate;
}
P.S. You may not be able to find both the items using this just by <Eq> tag as there may be time difference. For this to work you need to enclose the dates in <Leq> and <Geq> tags.
You can test your query using CAML query builder. To know about the basics of CAML query and how to use CAML query builder, read the following articles - they will help you out!
Basics of the CAML query and
Using CAML query builder

Resources