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 Senthil Kumar K <se...@trigent.com> on 2003/09/20 13:38:49 UTC

How to search document for modified date

Hi,

    How to make query to search in the lucene index
for document with specified date.While indexing
i made
 doc.add(Field.Keyword("modified",
DateField.timeToString(f.lastModified())))
like this.

If any one knows how to search for documents with specific date.
please give me a sample query.

thanks in advance.
regards,
k.senthilkumar.

-----Original Message-----
From: Rociel Buico [mailto:buics123@yahoo.com]
Sent: Saturday, September 20, 2003 7:55 AM
To: Lucene Users List
Subject: Re: cant rename segments.new to segment


i have downloaded the lucene-20030909.jar and its ok now,
but i have to stress test my application first.

btw, im running it on windows 2000

cheers,
buics

Bruce Ritchie <br...@jivesoftware.com> wrote:
Wilton, Reece wrote:

> Are people having this same issue on Linux or is this just a Windows
> issue?

I've only heard of the issue on Windows - I believe a patch from Matt
Tucker was actually
incorporated into Lucene that made some attempt to work around this
issue.


Regards,

Bruce Ritchie


> ATTACHMENT part 2 application/x-pkcs7-signature name=smime.p7s


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software


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


Re: Is it possible in lucene for numeric search

Posted by Terry Steichen <te...@net-frame.com>.
You can also use a RangeQuery.  If you index the field of numeric data, say
'score', as a string, then you can do things like: score:[75 TO 80].  Only
extra work is that you need to pad the actual score with enough 0's (such
that 9 becomes 09, etc.) to cover the expected range.

Regards,

Terry

----- Original Message -----
From: "Erik Hatcher" <er...@ehatchersolutions.com>
To: "Lucene Users List" <lu...@jakarta.apache.org>
Sent: Monday, September 22, 2003 9:08 AM
Subject: Re: Is it possible in lucene for numeric search


> Yes, you can do numeric searches as long as you realize its really just
> text that is indexed.  You will need to ensure the Analyzer you use
> indexes numbers appropriately as well.
>
> Erik
>
>
> On Monday, September 22, 2003, at 02:06  AM, Senthil Kumar K wrote:
>
> > Hi,
> >
> >   I found that lucene is a full-featured text search engine. Is it
> > possible to make it for numeric search. In my appl. I need to look
> > in to the index for score=75.
> >
> > regards,
> > k.senthilkumar
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>


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


Re: Is it possible in lucene for numeric search

Posted by Terry Steichen <te...@net-frame.com>.
You can also use a RangeQuery.  If you index the field of numeric data, say
'score', as a string, then you can do things like: score:[75 TO 80].  Only
extra work is that you need to pad the actual score with enough 0's (such
that 9 becomes 09, etc.) to cover the expected range.

Regards,

Terry

----- Original Message -----
From: "Erik Hatcher" <er...@ehatchersolutions.com>
To: "Lucene Users List" <lu...@jakarta.apache.org>
Sent: Monday, September 22, 2003 9:08 AM
Subject: Re: Is it possible in lucene for numeric search


> Yes, you can do numeric searches as long as you realize its really just
> text that is indexed.  You will need to ensure the Analyzer you use
> indexes numbers appropriately as well.
>
> Erik
>
>
> On Monday, September 22, 2003, at 02:06  AM, Senthil Kumar K wrote:
>
> > Hi,
> >
> >   I found that lucene is a full-featured text search engine. Is it
> > possible to make it for numeric search. In my appl. I need to look
> > in to the index for score=75.
> >
> > regards,
> > k.senthilkumar
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>


Re: Is it possible in lucene for numeric search

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Yes, you can do numeric searches as long as you realize its really just 
text that is indexed.  You will need to ensure the Analyzer you use 
indexes numbers appropriately as well.

	Erik


On Monday, September 22, 2003, at 02:06  AM, Senthil Kumar K wrote:

> Hi,
>
>   I found that lucene is a full-featured text search engine. Is it
> possible to make it for numeric search. In my appl. I need to look
> in to the index for score=75.
>
> regards,
> k.senthilkumar
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Is it possible in lucene for numeric search

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Yes, you can do numeric searches as long as you realize its really just 
text that is indexed.  You will need to ensure the Analyzer you use 
indexes numbers appropriately as well.

	Erik


On Monday, September 22, 2003, at 02:06  AM, Senthil Kumar K wrote:

> Hi,
>
>   I found that lucene is a full-featured text search engine. Is it
> possible to make it for numeric search. In my appl. I need to look
> in to the index for score=75.
>
> regards,
> k.senthilkumar
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org


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


Is it possible in lucene for numeric search

Posted by Senthil Kumar K <se...@trigent.com>.
Hi,
   
  I found that lucene is a full-featured text search engine. Is it 
possible to make it for numeric search. In my appl. I need to look 
in to the index for score=75. 

regards,
k.senthilkumar 


Is it possible in lucene for numeric search

Posted by Senthil Kumar K <se...@trigent.com>.
Hi,
   
  I found that lucene is a full-featured text search engine. Is it 
possible to make it for numeric search. In my appl. I need to look 
in to the index for score=75. 

regards,
k.senthilkumar 


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


Re: How to search document for modified date

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Sunday, September 21, 2003, at 05:38  AM, Senthil Kumar K wrote:
> Hi,
>
>   Erik thanks for your reply.
>   How to do using QueryParser expressions.

My personal take is using the date support in Lucene is not all that 
fun or easy because of the contortions necessary to deal with it.  But, 
QueryParser supports date field ranges (but not a term query by date 
field).  So, you can do it this way:

	date:[1/1/04 TO 1/1/04] for inclusive date ranges (only 1/1/04 found)
	date:{1/1/04 TO 1/5/04} for exclusive ranges (dates 1/2, 1/3, and 
1/4/04 are found, but not 1/1 or 1/5/04)



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


Re: How to search document for modified date

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Sunday, September 21, 2003, at 05:38  AM, Senthil Kumar K wrote:
> Hi,
>
>   Erik thanks for your reply.
>   How to do using QueryParser expressions.

My personal take is using the date support in Lucene is not all that 
fun or easy because of the contortions necessary to deal with it.  But, 
QueryParser supports date field ranges (but not a term query by date 
field).  So, you can do it this way:

	date:[1/1/04 TO 1/1/04] for inclusive date ranges (only 1/1/04 found)
	date:{1/1/04 TO 1/5/04} for exclusive ranges (dates 1/2, 1/3, and 
1/4/04 are found, but not 1/1 or 1/5/04)



RE: How to search document for modified date

Posted by Senthil Kumar K <se...@trigent.com>.
Hi,

  Erik thanks for your reply. 
  How to do using QueryParser expressions.

senthilkumar.k


-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
Sent: Saturday, September 20, 2003 6:42 PM
To: Lucene Users List
Subject: Re: How to search document for modified date


On Saturday, September 20, 2003, at 07:38  AM, Senthil Kumar K wrote:
> Hi,
>
>     How to make query to search in the lucene index
> for document with specified date.While indexing
> i made
>  doc.add(Field.Keyword("modified",
> DateField.timeToString(f.lastModified())))
> like this.
>
> If any one knows how to search for documents with specific date.
> please give me a sample query.

Query query = new TermQuery(new Term("modified", 
DateField.dateToString(date));

You could also do this with QueryParser expressions, although there are 
some caveats to date fields and its usage (must use default locale 
short date format strings, for instance).

	Erik


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

RE: How to search document for modified date

Posted by Senthil Kumar K <se...@trigent.com>.
Hi,

  Erik thanks for your reply. 
  How to do using QueryParser expressions.

senthilkumar.k


-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
Sent: Saturday, September 20, 2003 6:42 PM
To: Lucene Users List
Subject: Re: How to search document for modified date


On Saturday, September 20, 2003, at 07:38  AM, Senthil Kumar K wrote:
> Hi,
>
>     How to make query to search in the lucene index
> for document with specified date.While indexing
> i made
>  doc.add(Field.Keyword("modified",
> DateField.timeToString(f.lastModified())))
> like this.
>
> If any one knows how to search for documents with specific date.
> please give me a sample query.

Query query = new TermQuery(new Term("modified", 
DateField.dateToString(date));

You could also do this with QueryParser expressions, although there are 
some caveats to date fields and its usage (must use default locale 
short date format strings, for instance).

	Erik


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

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


Re: How to search document for modified date

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Saturday, September 20, 2003, at 07:38  AM, Senthil Kumar K wrote:
> Hi,
>
>     How to make query to search in the lucene index
> for document with specified date.While indexing
> i made
>  doc.add(Field.Keyword("modified",
> DateField.timeToString(f.lastModified())))
> like this.
>
> If any one knows how to search for documents with specific date.
> please give me a sample query.

Query query = new TermQuery(new Term("modified", 
DateField.dateToString(date));

You could also do this with QueryParser expressions, although there are 
some caveats to date fields and its usage (must use default locale 
short date format strings, for instance).

	Erik


Re: How to search document for modified date

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Saturday, September 20, 2003, at 07:38  AM, Senthil Kumar K wrote:
> Hi,
>
>     How to make query to search in the lucene index
> for document with specified date.While indexing
> i made
>  doc.add(Field.Keyword("modified",
> DateField.timeToString(f.lastModified())))
> like this.
>
> If any one knows how to search for documents with specific date.
> please give me a sample query.

Query query = new TermQuery(new Term("modified", 
DateField.dateToString(date));

You could also do this with QueryParser expressions, although there are 
some caveats to date fields and its usage (must use default locale 
short date format strings, for instance).

	Erik


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