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?

Reply via email to