Hello
To do this in one lucene query I think you'll need to flatten your data into something like Doc 1 title: lucene custom search start: 2009/01/28 end: 2009/01/28 Doc 2 title: lucene custom search start: 2009/01/29 end: 2009/01/30 Doc 3 title: some other text start: 2009/02/01 end: 2009/02/20 Doc 4 title: some other text start: 2009/02/02 end: 2009/02/21 Doc 5 title: some other text start: 2009/02/03 end: 2009/02/23 etc. and execute a search something like title:lucene AND start:[2009/01/01 TO 2009/01/28] AND end:[2009/01/28 TO 2099/12/31] See http://lucene.apache.org/java/2_3_2/queryparsersyntax.html for details on how to specify the query. I'd lose the delimiters from the date but that may not be necessary. If you have a large number of tasks and intervals your index will be large. If you have a large number of dates in your ranges you might need to increase the max clause count. See BooleanQuery.get/setMaxClauseCount(). You could probably get clever in encoding the date ranges somehow (I vaguely recall some discussion on this some time ago - maybe to do with hotel rooms) but I'd start simple. -- Ian. On Thu, Jan 29, 2009 at 1:16 PM, Nail Achmedzhanov <ach...@elewise.com> wrote: > Hello! > > Could not you help me? > I have a task: > There are two entities: > 1) Task with text field "title" > 2) TimeInterval with two fields "start", "and" type of DateTime > > Task is linked with TimeInterval as 1:n (one to many) > I have to look for task by > 1) text in title > 2) date contained in some interval > It's T-SQL analogue: > > select t.* from tasks where > CONTAINS (t.[text], "lucene custom search") > exists (select ti.intervalId from time_intervals ti where ti.begin <= > '2009/01/28' and ti.end >= '2009/01/28') > > How do ia have to create index and search criteria? > > > > -- > С уважением, > Ахмеджанов Наиль > Начальник отдела разработки ПО на базе Microsoft.NET > Компания Элевайз > e-mail: ach...@elewise.com > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org