Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 36949 invoked from network); 20 Sep 2004 06:57:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 20 Sep 2004 06:57:39 -0000 Received: (qmail 95348 invoked by uid 500); 20 Sep 2004 06:57:29 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 95325 invoked by uid 500); 20 Sep 2004 06:57:28 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 95297 invoked by uid 99); 20 Sep 2004 06:57:28 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of fraschetti@gmail.com designates 64.233.170.197 as permitted sender) Received: from [64.233.170.197] (HELO mproxy.gmail.com) (64.233.170.197) by apache.org (qpsmtpd/0.28) with ESMTP; Sun, 19 Sep 2004 23:57:25 -0700 Received: by mproxy.gmail.com with SMTP id 79so1494808rnl for ; Sun, 19 Sep 2004 23:57:20 -0700 (PDT) Received: by 10.38.74.50 with SMTP id w50mr1223348rna; Sun, 19 Sep 2004 23:57:20 -0700 (PDT) Received: by 10.38.171.15 with HTTP; Sun, 19 Sep 2004 23:57:20 -0700 (PDT) Message-ID: Date: Sun, 19 Sep 2004 23:57:20 -0700 From: Chris Fraschetti Reply-To: Chris Fraschetti To: Lucene Users List Subject: Re: range and content query In-Reply-To: <16718.30609.544477.817026@tanto-xipolis.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <16718.30609.544477.817026@tanto-xipolis.de> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I've more or less figured out the query string required to get a range of docs.. say date[0 TO 10] assuming my dates are from 1 to 10 (for the sake of this example) ... my query has results that I don't understand. if i do from 0 TO 10, then I only get results matching 0,1,10 ... if i do 0 TO 8, i get all results ... from 0 to 10... if i do 1 TO 5 ... then i get results 1,2,3,4,5,10 ... very strange. here is how my query looks... query: +date_field:[1 TO 5] here is how the date was added... Document doc = new Document(); doc.add(Field.UnIndexed("arcpath_field", filename)); doc.add(Field.Keyword("date_field", date)); doc.add(Field.Text("content_field", content)); writer.addDocument(doc); I tried Field.Text for the date and also received the same results. Essentially I have a loop to add 11 strings... indexes 0 to 10... and add "doc0", "0", "some text" for each.. and the results i get as as explained above... any ideas? Here is my simple searching code.. i'm currently not searching for any text... i just want to test the range feature right now.... query_string = " +("+DATE_FIELD+":["+start_date+" TO "+end_date+"])"; Searcher searcher = new IndexSearcher(index_path); QueryParser parser = new QueryParser(CONTENT_FIELD, new StandardAnalyzer()); parser.setOperator(QueryParser.DEFAULT_OPERATOR_OR); Query query = parser.parse(query_string); System.out.println("query: "+query.toString()); Hits hits = searcher.search(query); On Mon, 20 Sep 2004 08:24:17 +0200, Morus Walter wrote: > Chris Fraschetti writes: > > can someone assist me in building or deny the possibility of combing a > > range query and a standard query? > > > > say for instance i have two fields i'm searching on... one being the a > > field with an epoch date associated with the entry, and the > > content.... so how can I make a query to select a range of thos > > epochs, as well as search through the content? can it be done in one > > query, or do I have to perform a query upon a query, and if so, what > > might the syntax look like? > > > if you create the query using the API use a boolean query to combine > the two basic queries. > > If you use query parser use AND or OR. > > Note that range queries are expanded into boolean queries (OR combined) > which may be a problem if the number of terms matching the range is too > big. Depends on your date entries and especially how precise they are. > Alternatively you might consider using a filter. > > HTH > Morus > -- ___________________________________________________ Chris Fraschetti, Student CompSci System Admin University of San Francisco e fraschetti@gmail.com | http://meteora.cs.usfca.edu --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org