You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by Doug Cutting <cu...@nutch.org> on 2005/04/11 23:29:37 UTC

sorting search results

Currently query filters generate a Lucene Query.  But Lucene's search 
methods have other parameters besides a query.  In particular, these can 
also be passed a Filter and a Sort.  In part as a work-around, Nutch 
automatically converts Lucene query clauses with zero boost into 
filters.  But there is currently no way to generate sorted results using 
Nutch's search API.

To remedy this I propose that the QueryFilter API be changed to 
something like:

public class SearchParameters {
   public BooleanQuery getQuery();
   public void setQuery(BooleanQuery clauses);

   public Filter getFilter();
   public void setFilter(Filter filter);

   public Sort getSort();
   public void getSort(Sort sort);
}

public interface QueryFilter {
   SearchParameters filter(Query input, SearchParameters output)
     throws QueryException;
}

If no one objects I will make this change and update all QueryFilters in 
SVN.  Then I will add a SortQueryFilter that permits clauses like 
"sort:date", and a DateRangeQueryFilter that uses Lucene's RangeFilter 
(generally much more efficient than a RangeQuery).

Thoughts?

Doug

RE: sorting search results

Posted by Chirag Chaman <de...@filangy.com>.
This is definitely helpful.
We can get rid of quite a bit of custom code we wrote and manually merge
with each release.
 
CC-


-----Original Message-----
From: Doug Cutting [mailto:cutting@nutch.org] 
Sent: Monday, April 11, 2005 5:30 PM
To: nutch-dev@incubator.apache.org
Subject: sorting search results

Currently query filters generate a Lucene Query.  But Lucene's search
methods have other parameters besides a query.  In particular, these can
also be passed a Filter and a Sort.  In part as a work-around, Nutch
automatically converts Lucene query clauses with zero boost into filters.
But there is currently no way to generate sorted results using Nutch's
search API.

To remedy this I propose that the QueryFilter API be changed to something
like:

public class SearchParameters {
   public BooleanQuery getQuery();
   public void setQuery(BooleanQuery clauses);

   public Filter getFilter();
   public void setFilter(Filter filter);

   public Sort getSort();
   public void getSort(Sort sort);
}

public interface QueryFilter {
   SearchParameters filter(Query input, SearchParameters output)
     throws QueryException;
}

If no one objects I will make this change and update all QueryFilters in
SVN.  Then I will add a SortQueryFilter that permits clauses like
"sort:date", and a DateRangeQueryFilter that uses Lucene's RangeFilter
(generally much more efficient than a RangeQuery).

Thoughts?

Doug