Just use one of the search() methods that does sorting and specify an
array of sort fields with SortField.SCORE first, then your name
fields.  But be aware that complex real world textual queries and docs
rarely produce identical scores.

You could post-process the results and group them into "good", "OK",
"bad" and sort those groups by name, but then you're in to the thorny
and contentious area of score normalisation.  Although since you're
already using fuzzy queries (and wildcards? your example query shows
"FamilyName: smith *~^8" which looks invalid) maybe you aren't too
bothered about exact ranking.  Play around and use whatever works for
you.



--
Ian.


On Mon, Nov 28, 2011 at 4:17 AM, Romiko Derbynew
<romiko.derby...@readify.net> wrote:
> Hi Guys,
>
> I am using Lucene with Neo4j. Currently I have queries working well with a 
> combination of Exact and Fuzzy matches in one query.
>
> However, we desire a report that first takes the ranking and boosting as the 
> highest priority, but then we want to sort my first name and last name, and 
> always have the highest ranks on top. I cannot find a way to do this with the 
> Query Parser API 
> (http://lucene.apache.org/java/2_9_1/queryparsersyntax.html), is this the 
> case, or do I have to succumb to by passing the query parser API and 
> executing a custom sort via groovy on Neo4j?
>
>
> Current Query sample:
> "+(FamilyName:smith*^8 FamilyName: smith *~^8 GivenName: smith *^2 GivenName: 
> smith *~^2)
>
>
> So if I get these result
> Nadia Smith (This was on top as it was first entry in the index)
> John Smith
> Smith Michaels
> Smith Marks
> Adam Smith
> Bob Smath
>
> I want it to then sort by first name and then by last name, but keep the 
> highest ranks at top.
> Adam Smith
> Nadia Smith
> John Smith
> Smith Marks
> Smith Michaels
> Bob Smath
>
> Thanks in advance for any advice.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to