Assuming that you know the unique ID when constructing the query (which it sounds like you do) why not try a boost query with a high boost for 2 and a lower boost for 1 - then the default sort by score should match your desired ordering, and this order can be further tweaked with other bf or bq arguments.
-Peter On Thu, Jul 16, 2009 at 9:15 AM, Matt Schraeder<mschrae...@btsb.com> wrote: > The first number is a unique ID that points to a particular customer, > the second is a value. It basically tells us whether or not a customer > already has that product or not. The main use of it is to be able to > search our product listing for products the customer does not already > have. > > The alternative would be to put that in a second index, but that would > mean that I would be doing two searches for every single search I want > to complete, which I am not sure would be a very good option. > >>>> avl...@gmail.com 7/16/2009 12:04:53 AM >>> > > The harsh reality of life is that you cannot sort on multivalued > fields. > If you can explain your domain problem (the significance of numbers > "818", > "2" etc), maybe people can come up with an alternate index design which > fits > into your use cases. > > Cheers > Avlesh > > On Thu, Jul 16, 2009 at 1:18 AM, Matt Schraeder <mschrae...@btsb.com> > wrote: > >> I am trying to come up with a way to sort (or score, and sort based > on >> the score) of a multivalued field. I was looking at FunctionQueries > and >> saw fieldvalue, but as that only works on single valued fields that >> doesn't help me. >> >> The field is as follows: >> >> <fieldType name="keyword" class="solr.TextField" >> sortMissingLast="true" omitNorms="true"> >> <analyzer> >> <!-- KeywordTokenizer does no actual tokenizing, so the > entire >> input string is preserved as a single token >> --> >> <tokenizer class="solr.KeywordTokenizerFactory"/> >> <!-- The LowerCase TokenFilter does what you expect, which > can >> be >> when you want your sorting to be case insensitive >> --> >> <filter class="solr.LowerCaseFilterFactory" /> >> <!-- The TrimFilter removes any leading or trailing > whitespace >> --> >> <filter class="solr.TrimFilterFactory" /> >> </analyzer> >> </fieldType> >> >> <field name="myfield" type="keyword" index="true" stored="true" >> multiValued="true" /> >> >> The actual data that gets put in this field is a string consisting of > a >> number, a space, and a 1 or a 2. For example: >> >> "818 2" >> "818 1" >> "950 1" >> "1022 2" >> >> I want to be able to give my search results given a boost if a >> particular document contains "818 2" and a smaller boost if the > document >> contains "818 1" but not "818 2". >> >> The end result would be documents sorted as follows: >> >> 1) Documents with "818 2" >> 2) Documents with "818 1" but not "818 2" >> 3) Documents that contain neither "818 2" nor "818 1" >> >> Is this possible with solr? How would I go about doing this? >> > > -- Peter M. Wolanin, Ph.D. Momentum Specialist, Acquia. Inc. peter.wola...@acquia.com