lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley" <>
Subject Re: MissingStringLastComparatorSource and MultiSearcher
Date Fri, 14 Jul 2006 17:30:29 GMT
On 7/14/06, Rob Staveley (Tom) <> wrote:
> Chris Hostetter and Yonik's MissingStringLastComparator looks like a neat
> way to specify where to put null values when you want them to appear at the
> end of reverse sorts rather than at the beginning, but I spotted the note...
>     // Note: basing lastStringValue on the StringIndex won't work
>     // with a multisearcher.
> Is that a show-stopper for MultiSearchers, or does it just mean that it is a
> bit less efficient?
Short answer: it should work for 99.99999% of indicies :-)

That comment just related to the original code that's now commented
out that based the sort-value for missing values on the largest item
in the index.

To fix that, missingValueProxy was added and defaulted to bigString.
That's what will be used to collate results in a multisearcher when
the field value is missing.  So this scheme will only fail if you have
field values that compare bigger than bigString (or whatever you pass
in as missingValueProxy).

See the code below:

  public static final String

  private final String missingValueProxy;

  public MissingStringLastComparatorSource() {

	 * Returns the value used to sort the given document.  The
	 * object returned must implement the
	 * interface.  This is used by multisearchers to determine how to
collate results from their searchers.
	 * @see FieldDoc
	 * @param i Document
	 * @return Serializable object

  /** Creates a {@link SortComparatorSource} that uses
<tt>missingValueProxy</tt> as the value to return from
   * which is only used my multisearchers to determine how to collate
results from their searchers.
   * @param missingValueProxy   The value returned when sortValue() is
called for a document missing the sort field.
   * This value is *not* normally used for sorting, but used to create
  public MissingStringLastComparatorSource(String missingValueProxy) {

-Yonik Solr, the open-source Lucene search server

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message