Return-Path: X-Original-To: apmail-lucene-solr-user-archive@minotaur.apache.org Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C2108D84 for ; Thu, 15 Sep 2011 19:34:03 +0000 (UTC) Received: (qmail 36571 invoked by uid 500); 15 Sep 2011 19:33:59 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 36460 invoked by uid 500); 15 Sep 2011 19:33:59 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 36452 invoked by uid 99); 15 Sep 2011 19:33:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Sep 2011 19:33:59 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [162.129.8.141] (HELO ipex1.johnshopkins.edu) (162.129.8.141) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Sep 2011 19:33:51 +0000 X-IronPort-AV: E=Sophos;i="4.68,389,1312171200"; d="scan'208";a="93521735" Received: from sys02.staff.ad.mse.jhu.edu (HELO [128.220.8.101]) ([128.220.8.101]) by ipex1.johnshopkins.edu with ESMTP/TLS/DHE-RSA-CAMELLIA256-SHA; 15 Sep 2011 15:33:26 -0400 Message-ID: <4E725306.3040300@jhu.edu> Date: Thu, 15 Sep 2011 15:33:26 -0400 From: Jonathan Rochkind User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.20) Gecko/20110804 Thunderbird/3.1.12 MIME-Version: 1.0 To: solr-user@lucene.apache.org Subject: Re: query for point in time References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit You didn't tell us what your schema looks like, what fields with what types are involved. But similar to how you'd do it in your database, you need to find 'documents' that have a start date before your date in question, and an end date after your date in question, to find the ones whose range includes your date in question. Something like this: q=start_date:[* TO '2010-01-05'] AND end_date:['2010-01-05' TO *] Of course, you need to add on your restriction to just documents about 'John Smith', through another AND clause or an 'fq'. But in general, if you've got a db with this info already, and this is all you need, why not just use the db? Multi-hieararchy data like this is going to give you trouble in Solr eventually, you've got to arrange the solr indexes/schema to answer your questions, and eventually you're going to have two questions which require mutually incompatible schema to answer. An rdbms is a great general purpose question answering tool for structured data. lucene/Solr is a great indexing tool for text matching. On 9/15/2011 2:55 PM, gary tam wrote: > Hi > > I have a scenario that I am not sure how to write the query for. > > Here is the scenario - have an employee record with multi value for project, > started date, end date. > > looks something like > > > John Smith web site bug fix 2010-01-01 2010-01-03 > unit testing 2010-01-04 > 2010-01-06 > QA support 2010-01-07 > 2010-01-12 > implementation 2010-01-13 > 2010-01-22 > > I want to find what project John Smith was working on 2010-01-05 > > Is this possible or I have to back to my database ? > > > Thanks >