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 <nilu.tha...@gmail.com> 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-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >