lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <>
Subject Re: Sorting fields while searching!
Date Mon, 01 Jun 2009 21:16:43 GMT
It's really unclear to me what
returns. I assume the intent is to return a field name, but
how that relates to

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
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.....


On Mon, Jun 1, 2009 at 2:07 PM, vanshi <> wrote:

> I have two fields initialized following way for Index writing:
> 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:
> Sent from the Lucene - Java Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message