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