You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by sam <ha...@yahoo.com.cn> on 2012/07/11 10:31:50 UTC

about some date store

I want store some data like 00:00:00.123,it's string,i want print it as date
.because i want sort it as date's increase. 

--
View this message in context: http://lucene.472066.n3.nabble.com/about-some-date-store-tp3994330.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: about some date store

Posted by Danil Ε’ORIN <to...@gmail.com>.
Listen to Uwe.

Keeping your date/time in milliseconds is the best solution.

You don't care about how the user likes his data DD.MM.YYYY (Europe)
of MM.DD.YYYY(US), about timezones, daylight saving changes, leap
seconds, or any other complications.

Your dates are simple long numbers, you can easy sort them, do ranges
and whatever you like.


On Wed, Jul 11, 2012 at 12:15 PM, Uwe Schindler <uw...@thetaphi.de> wrote:
> Hi,
>
> Use NumericField and NumericRangeQuery to query. For sorting use the
> corresponding datatype. In the numeric field you would parse the date to a
> number (e.g. milliseconds since epoch) and index it using NumericField. To
> print them, use SimpleDateFormat or whatever to convert the numeric value
> back to a date after you got the results.
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>
>> -----Original Message-----
>> From: sam [mailto:hairen512@yahoo.com.cn]
>> Sent: Wednesday, July 11, 2012 10:32 AM
>> To: java-user@lucene.apache.org
>> Subject: about some date store
>>
>> I want store some data like 00:00:00.123,it's string,i want print it as
> date
>> .because i want sort it as date's increase.
>>
>> --
>> View this message in context: http://lucene.472066.n3.nabble.com/about-
>> some-date-store-tp3994330.html
>> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


RE: about some date store

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,

Use NumericField and NumericRangeQuery to query. For sorting use the
corresponding datatype. In the numeric field you would parse the date to a
number (e.g. milliseconds since epoch) and index it using NumericField. To
print them, use SimpleDateFormat or whatever to convert the numeric value
back to a date after you got the results.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: sam [mailto:hairen512@yahoo.com.cn]
> Sent: Wednesday, July 11, 2012 10:32 AM
> To: java-user@lucene.apache.org
> Subject: about some date store
> 
> I want store some data like 00:00:00.123,it's string,i want print it as
date
> .because i want sort it as date's increase.
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/about-
> some-date-store-tp3994330.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: about some date store

Posted by Ian Lea <ia...@gmail.com>.
So "content" is a String variable in your program holding a multi-line
value, is it?  I'd double check exactly what that is holding before
you store it in the index.


--
Ian.


On Mon, Jul 16, 2012 at 4:56 AM, sam <ha...@yahoo.com.cn> wrote:
> I had done that,I used the docment.add(new
> field("content",content,field.store.yes,filed.analyzer.yes));i have used
> while loop to set the content like while((str=reader.readline)!=null) ,But
> when i used document.get("content"),i can only get the first LIne.
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/about-some-date-store-tp3994330p3995193.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: about some date store

Posted by sam <ha...@yahoo.com.cn>.
I had done that,I used the docment.add(new
field("content",content,field.store.yes,filed.analyzer.yes));i have used
while loop to set the content like while((str=reader.readline)!=null) ,But
when i used document.get("content"),i can only get the first LIne.

--
View this message in context: http://lucene.472066.n3.nabble.com/about-some-date-store-tp3994330p3995193.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: about some date store

Posted by Erick Erickson <er...@gmail.com>.
You can only show that is stored (Field.Store.YES). Only then can
you use document.get(...) and get something to display

Best
Erick
On Thu, Jul 12, 2012 at 2:55 AM, sam <ha...@yahoo.com.cn> wrote:
> it's take a new problem,what even I seaching,I can only get the first line
> data,if the data can be seach.and ,when i find my content in luke.i can find
> all the data in the content,but i just can not show it.
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/about-some-date-store-tp3994330p3994579.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: about some date store

Posted by sam <ha...@yahoo.com.cn>.
it's take a new problem,what even I seaching,I can only get the first line
data,if the data can be seach.and ,when i find my content in luke.i can find
all the data in the content,but i just can not show it.

--
View this message in context: http://lucene.472066.n3.nabble.com/about-some-date-store-tp3994330p3994579.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org