Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep data in SOLR #29

Open
sebiboga opened this issue Apr 16, 2024 · 0 comments
Open

keep data in SOLR #29

sebiboga opened this issue Apr 16, 2024 · 0 comments

Comments

@sebiboga
Copy link
Contributor

add field to save DATE of posting in Apache SOLR
In Apache Solr, you can store dates in a field of type solr.DatePointField or solr.TrieDateField (deprecated as of Solr 7.0.0). The format for this field is a restricted subset of the canonical representation of dateTime in the XML Schema specification – a format compatible with ISO-8601.

Here is an example: 2006-11-13T00:00:00Z

Here's how you store datePosted:

In your Solr schema (schema.xml), define a field to hold the date. For example:

xml

When you index documents, use the ISO-8601 combined date and time format in UTC:

json

{
"id": "job1",
"datePosted": "2020-12-31T00:00:00Z"
}
Remember to replace "2020-12-31T00:00:00Z" with your actual date.

You can also use Solr's built-in NOW function to automatically use the current time whenever you add a document to the index:

json

{
"id": "job1",
"datePosted": "NOW"
}
After adding this field, you'll be able to run queries that return documents based on the datePosted field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant