lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hui Ouyang" <...@triplehop.com>
Subject RE: HTMLDocument.java example
Date Tue, 08 Apr 2003 13:30:51 GMT
Hi,
Do you know which one is faster? The date filter or data range query?
Regards,
Hui

	-----Original Message----- 
	From: Per Böckman [mailto:pebo@enea.se] 
	Sent: Tue 4/8/2003 4:18 AM 
	To: 'Lucene Users List' 
	Cc: 
	Subject: RE: HTMLDocument.java example
	
	

	Hi,
	
	I guess that you could apply a filter when you search. This way you could
	filter Documents based on dates that are "between", "after" or "before":
	
	// filter out Documents that are "modified, published, ..." after the
	current date
	DateFilter filter = DateFilter.Before(YOUR_DATE_FIELD, new Date());
	Searcher searcher = ...
	Query query = ....
	Hits hits = searcher.search(query, filter);
	
	Regards,
	Per
	
	
	> -----Original Message-----
	> From: Simon Lieschke [mailto:simon.lieschke@orionhealth.com]
	> Sent: den 8 april 2003 08:02
	> To: Lucene Users List
	> Subject: RE: HTMLDocument.java example
	>
	>
	> Uh-huh!
	>
	> Reading the QueryParser source code (which I probably should
	> have done first) reveals it will first attempt to treat a
	> range query as two dates, attempt to parse them and convert
	> them to string form using the DateField.dateToString method
	> (which is how the dates are stored in the index). Perhaps the
	> comment HTMLDocument.java code snippet needs to be a bit more
	> explicit as to why the dates get stored in the format they
	> do, so people like me don't get somewhat confused.
	>
	> Looking at the code also reveals there is currently no way to
	> specify wildcards for dates (like if I want to search all
	> docs before a certain date, or all docs after a certain date).
	>
	> Cheers,
	>
	>
	> Simon
	>
	> -----Original Message-----
	> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
	> Sent: Tuesday, 8 April 2003 5:04 p.m.
	> To: Lucene Users List
	> Subject: RE: HTMLDocument.java example
	>
	>
	> I didn't really read all this carefully, but yes, you can use
	> dates in range queries with Lucene's QueryParser.  Query
	> sytax page has the details and should show the format of the
	> date that a user would have to enter in order for the
	> QueryParser to correctly handle dates. I guess you could
	> always try to handle users' date input yourself in your
	> application and convert it to the format that QueryParser
	> will understand.
	>
	> Otis
	>
	>
	> --- Simon Lieschke <simon.lieschke@orionhealth.com> wrote:
	> > Yes, there is.
	> >
	> > But as far as I can tell, the intention of the example code is to
	> > provide a searchable date field. Problem is that the
	> modified date is
	> > stored in a format that isn't very "human searchable". As
	> I've had no
	> > replies saying otherwise, I beginning to think there indeed
	> is a flaw
	> > in the implementation of the sample code here.
	> >
	> > Cheers,
	> >
	> >
	> > Simon
	> >
	> > -----Original Message-----
	> > From: Terry Steichen [mailto:terry@net-frame.com]
	> > Sent: Tuesday, 8 April 2003 12:31 a.m.
	> > To: Lucene Users List
	> > Subject: Re: HTMLDocument.java example
	> >
	> >
	> > Simon,
	> >
	> > I believe there's another method in DateField that converts
	> the value
	> > into a human readable form.
	> >
	> > Regards,
	> >
	> > Terry
	> >
	> > ----- Original Message -----
	> > From: "Simon Lieschke" <simon.lieschke@orionhealth.com>
	> > To: <lucene-user@jakarta.apache.org>
	> > Sent: Monday, April 07, 2003 12:41 AM
	> > Subject: HTMLDocument.java example
	> >
	> >
	> > The example code that ships with Lucene includes the
	> following snippet
	> > in
	> > HTMLDocument.java:
	> >
	> >     // Add the last modified date of the file a field named
	> > "modified".  Use a
	> >     // Keyword field, so that it's searchable, but so that
	> no attempt
	> > is
	> > made
	> >     // to tokenize the field into words.
	> >     doc.add(Field.Keyword("modified",
	> >   DateField.timeToString(f.lastModified())));
	> >
	> > Now, I guess the point of this is so that we can search for HTML
	> > documents using Lucene's range search syntax. But as far as I can
	> > tell, the result of
	> > DateField.timeToString(f.lastModified()) returns a
	> non-human readable
	> > date
	> > format, hence the modified field will not really be "human
	> > searchable"
	> > format. Is this an oversight in the example implementation, or am I
	> > just
	> > missing something else here?
	> >
	> > Thanks in advance,
	> >
	> >
	> > Simon
	> >
	> >
	> ---------------------------------------------------------------------
	> > 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
	> >
	>
	>
	> __________________________________________________
	> Do you Yahoo!?
	> Yahoo! Tax Center - File online, calculators, forms, and more
	http://tax.yahoo.com
	
	---------------------------------------------------------------------
	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
	
	

Mime
View raw message