[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lucene-user
Subject:    Re: custom sort
From:       Chris Hostetter <hossman_lucene () fucit ! org>
Date:       2005-08-31 22:11:20
Message-ID: Pine.LNX.4.58.0508311346560.3669 () hal ! rescomp ! berkeley ! edu
[Download RAW message or body]


: What I'm doing now is taking the whole resulting document collection,
: iterating through it and manually moving these 10 documents to the front
: of the collection.  This is slow and ugly.  I was hoping there might be
: a slicker way to do it as part of the actual sort.  I will play around
: with the custom sorting and report back if I figure out an elegant way
: to do it.

you could definitely do this with a Custom Sort ... but a simpler way to
go would be to do two searches.  if the users's basic search criteria is
soemthing like "foo:bar +yak:wak" and the criteria for identifying the
documents you want to return is "promote:yes" then first issue a search
for "+promote:yes +(foo:bar +yak:wak)" and display the first N, and keep
track of hte identity of the N that you display  Then do
a search for "foo:bar +yak:wak -id:id1 -id:id2 -id:id3 ... -id:idN"

this is assuming that you you only want to display the first N (sounds
like N is ten) but there might be a lot more then N which match but you
want the rest to display in their regular spots.  if you want them *ALL*
to be in the front, then making your second search "-promote:yes +(foo:bar
+yak:wak)" should work just fine.



-Hoss


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic