Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0969DDB49 for ; Tue, 26 Jun 2012 17:13:29 +0000 (UTC) Received: (qmail 50581 invoked by uid 500); 26 Jun 2012 17:13:27 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 50517 invoked by uid 500); 26 Jun 2012 17:13:26 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 50504 invoked by uid 99); 26 Jun 2012 17:13:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2012 17:13:26 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ian.lea@gmail.com designates 209.85.213.52 as permitted sender) Received: from [209.85.213.52] (HELO mail-yw0-f52.google.com) (209.85.213.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2012 17:13:21 +0000 Received: by yhpp61 with SMTP id p61so180244yhp.11 for ; Tue, 26 Jun 2012 10:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=5H5eLOtt7V49pzsSdVN2fm2aI3X4Fsd3OcUTJpAtqKY=; b=WL3k2UAUZTFCyQXEki9R5GAf4/GcC5a2cqQf8hTwcUNGUDdpYTgQIR4FbMODIBp1qt Ybsx5PqYSYB1syqL5jqVmQSZ3djd+8GRsWRVg6s2wHycm/6aNEJRq2MfOM+Lnm1GDQtC FPkRN4/V8GPlKthakP5g3F3r7bCnMuOn5gkI4StrJWF5fk9nq+zEfrzZV+qpYZ+1P+81 pCHY5QjSHa5Bp/64NrzY/mBjdYe2ynBQWGtABtcHImIvMYLDX54M8sxAxl2Z5sjIcEyf iFOGIf9Zmp+ZOG1/stvfMNyWhGV2o10Vh7Zcqrn71r+QElpeMQLaBaFGeW4Vz5Q1ST7S /Vew== Received: by 10.42.155.200 with SMTP id v8mr9676999icw.12.1340730780939; Tue, 26 Jun 2012 10:13:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.96.138 with HTTP; Tue, 26 Jun 2012 10:12:40 -0700 (PDT) In-Reply-To: References: From: Ian Lea Date: Tue, 26 Jun 2012 18:12:40 +0100 Message-ID: Subject: Re: Lucene Query About Sorting To: java-user@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Do you mean you want all hits that match B:abc, sorted by field A? As opposed to the top 100 hits sorted by field A? Just pass a higher value in the search(query, ... 100, ...) call. It will be slower and potentially use more memory but with only 10K docs you probably won't notice. -- Ian. On Tue, Jun 26, 2012 at 4:05 AM, Yogesh patel wrote: > Hi, > > I have one query of lucene about sort. > > I have 10000 documents in my index which having fields A,B,C,D. i want > first 100 results in my query but they must be sort by field A. > Suppose I have query "B:abc". > > so used below code with search : > > qp is object of query parser. > > Query query=qp.parse("B:abc"); > > Sort sort= new Sort(new SortField("A",SortField.STRING_VAL,true)); > > hits = searcher.search(query, null,100,sort); > > but when i search above way.it gives me result in sorting but sorting > applies to only matching first 100 results.It search first 100 results and > then sort. I want first 100 sorted descending of Field A with matching > query. > > Is it possible in Lucene? > > Thanks > > *Regards, > > Yogesh Patel* --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org