Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 2611 invoked from network); 5 Aug 2008 19:53:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Aug 2008 19:53:03 -0000 Received: (qmail 79586 invoked by uid 500); 5 Aug 2008 19:52:55 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 79543 invoked by uid 500); 5 Aug 2008 19:52:55 -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 79532 invoked by uid 99); 5 Aug 2008 19:52:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Aug 2008 12:52:55 -0700 X-ASF-Spam-Status: No, hits=3.2 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [66.173.27.67] (HELO mail.nasi.com) (66.173.27.67) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Aug 2008 19:52:00 +0000 In-Reply-To: <4898AC39.7050403@gmail.com> To: java-user@lucene.apache.org Cc: java-user@lucene.apache.org Subject: Re: Sorting MIME-Version: 1.0 X-Mailer: Lotus Notes Release 6.5.4 March 27, 2005 Message-ID: From: Robert.Hastings@ancept.com Date: Tue, 5 Aug 2008 14:51:41 -0500 X-MIMETrack: Serialize by Router on notes1/NASI(Release 6.5.5FP1|April 11, 2006) at 08/05/2008 14:52:10, Serialize complete at 08/05/2008 14:52:10 Content-Type: multipart/alternative; boundary="=_alternative 006D263F8625749C_=" X-Virus-Checked: Checked by ClamAV on apache.org --=_alternative 006D263F8625749C_= Content-Type: text/plain; charset="US-ASCII" This is what I did and it works fine. My untokenized fields where named: "__AMSUNTOK__" + fieldName. Where fieldName was the name of the tokenized field. Bob Hastings Ancept Inc. Mark Miller 08/05/2008 02:38 PM Please respond to java-user@lucene.apache.org To java-user@lucene.apache.org cc Subject Re: Sorting Hey Andre, The reason the javadoc says the field should not be tokenized stems from the issue you point out. What you want to do is possible of course, but making the Lucene code change would complicate a process that can be quite memory and cpu intensive on large collections. Done right, it might make a good patch though. A compromise that you can make outside of the Lucene code is to index a separate field with the same contents but untokenized. Sorting on this field instead, Lucene will treat "North Carolina" as one token and sort as you'd expect. The downside to this approach is that you will have to juggle the two fields in the future. - Mark Andre Rubin wrote: > Hi there! > > I'm new to Lucene, so forgive any misconceptions on my part. > > I created an Index and now I want to search on it based on a field. > The field is a String field and Field.Store.YES and > Field.Index.TOKENIZED. No problems with the search. > > Now, I wanted to sort the results, and according to the Sort javadoc > the field "should not be tokenized". But I decided to try it anyway, > and it worked. However, the results showed that the tokens were > sorted, not the full string in the field. > > Just to make myself more clear, here's an example. Let's say I have > these strings indexed: > > "North Carolina" > "British Columbia" > "Canada" > > Now I search (with sort) for the token 'c*' > > The result I get is (sorted by the token found): > > 1) Canada > 2) North Carolina > 3) British Columbia > > The result I wanted was (sorted by the whole String)" > > 1) British Columbia > 2) Canada > 3) North Carolina > > Is there a way to do this? > > > Another option would be to sort the index itself, since this field is > the only field that we'd be searching on. But I'm just guessing here, > cause I have no idea if this is possible at all! > > Thanks, > > > Andre > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org --=_alternative 006D263F8625749C_=--