Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 21082 invoked from network); 1 Jun 2009 21:17:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Jun 2009 21:17:06 -0000 Received: (qmail 95360 invoked by uid 500); 1 Jun 2009 21:17:16 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 95290 invoked by uid 500); 1 Jun 2009 21:17:15 -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 95279 invoked by uid 99); 1 Jun 2009 21:17:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jun 2009 21:17:15 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of erickerickson@gmail.com designates 209.85.221.180 as permitted sender) Received: from [209.85.221.180] (HELO mail-qy0-f180.google.com) (209.85.221.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jun 2009 21:17:04 +0000 Received: by qyk10 with SMTP id 10so5204996qyk.29 for ; Mon, 01 Jun 2009 14:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=wtp4aTrsZeEEkTePaeiyW+EsOhxY9WXtBEMHqt/87xo=; b=FEqa6Y6TzdiI6m4X+NpyWQtsDy0BjitTEPrMhlx0OKx3IMN+8fFaMBk8n0EiEOjZt0 YZ++oarhFNKWGdfBhIGeTakLrEQD2tMFA9mj1+pYwKy8E178Stiz8PKvvwb3GbeLdhpY E9G3eNprJBcEv7+Xni1b333a6KQAyJFUX6ADM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=IWeu4w5+Yj3L4S7PTsM3walnSghrLCqDJLUZKmVH8icdXKF/w5nyNoBElIEpFaRbcA qRm+Ka5xGvmf0mxZkg0q7KMMKNyOJdoI4SFIKXYRo5k55rJjRFoClNpypGRuepfVu2ny 9VR4YHgjSxiGnZNYlKSzEM2ex1LYaJdLh3QTw= MIME-Version: 1.0 Received: by 10.220.71.6 with SMTP id f6mr4508116vcj.16.1243891003658; Mon, 01 Jun 2009 14:16:43 -0700 (PDT) In-Reply-To: <23819354.post@talk.nabble.com> References: <23819354.post@talk.nabble.com> Date: Mon, 1 Jun 2009 17:16:43 -0400 Message-ID: <359a92830906011416k3fee70f8ufdd7b7441bdaa545@mail.gmail.com> Subject: Re: Sorting fields while searching! From: Erick Erickson To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=001485e8d21669a71d046b4ff1bc X-Virus-Checked: Checked by ClamAV on apache.org --001485e8d21669a71d046b4ff1bc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit It's really unclear to me what PhysicianFieldInfo.FIRST_NAME_EXACT.toString() returns. I assume the intent is to return a field name, but how that relates to FIRST_NAME_EXACT(Field.Store.YES, Field.Index.UN_TOKENIZED) doesn't mean anything to me. Could you provide some details? Note that if you specify a sort field that isn't in the document it has no effect (i.e. if your PhysicianFieldInfo.FIRST_NAME_EXACT.toString() returns something like "2309884@"). I'll ask the dumb question: you *are* passing your sort object(s) to the search, right? Finally, take some care about capitalization. My memory is weak, so check that your casing on the sort fields isn't messing you up. I'd think about lower or upper case everything you expect to sort on when indexing since you're not displaying it anyway..... Best Erick On Mon, Jun 1, 2009 at 2:07 PM, vanshi wrote: > > I have two fields initialized following way for Index writing: > > FIRST_NAME_EXACT(Field.Store.YES, Field.Index.UN_TOKENIZED), > LAST_NAME_EXACT(Field.Store.YES, Field.Index.UN_TOKENIZED), > > I have a prefix query to look for any name starting with the name entered > by > the user. Lets say user enters 'kar' as FName and 'johns' as last name and > then the prefix query becomes 'kar*' 'johns*'. I need to display result in > alphabatical order....that means 'kara johns' must come before 'karen > johns'. First I thought, prefix query itself will rank document with the > alphabatical order but that does not seem the case. So, now I'm trying to > sort while searching, with this code.....but I don't see any difference > between wht the results were before and what they are now. > > sorts.add(new SortField(PhysicianFieldInfo.FIRST_NAME_EXACT.toString(), > SortField.STRING )); > sorts.add(new SortField(PhysicianFieldInfo.LAST_NAME_EXACT.toString(), > SortField.STRING )); > > After these 2 sorting, I'm also doing sorting on some other fields but i > guess the name sorting should take precedence over later sortings. Can > anybody suggest what I'm doing wrong here? > > Thanks, > Vanshi > -- > View this message in context: > http://www.nabble.com/Sorting-fields-while-searching%21-tp23819354p23819354.html > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > --001485e8d21669a71d046b4ff1bc--