From a76bf773c6de50c6734d769a000f214eb6cbbd21 Mon Sep 17 00:00:00 2001 From: "Chris M. Hostetter" Date: Thu, 22 Feb 2007 00:22:10 +0000 Subject: [PATCH] SOLR-152 - support for q.alt in dismax handler so requests without query strings can return results based on whatever alternate query is configured git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@510322 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 6 ++ example/solr/conf/solrconfig.xml | 1 + .../solr/request/DisMaxRequestHandler.java | 92 ++++++++++++------- .../org/apache/solr/util/DisMaxParams.java | 5 + .../apache/solr/DisMaxRequestHandlerTest.java | 15 ++- src/test/test-files/solr/conf/solrconfig.xml | 1 + 6 files changed, 85 insertions(+), 35 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8d1e749679f..ebfcdfe3772 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -110,6 +110,12 @@ New Features 13. SOLR-86: Added standalone Java-based command-line updater. (Erik Hatcher via Bertrand Delecretaz) +14. SOLR-152: DisMaxRequestHandler now supports configurable alternate + behavior when q is not specified. A "q.alt" param can be specified + using SolrQueryParser syntax as a mechanism for specifying what query + the dismax handler should execute if the main user query (q) is blank. + (Ryan McKinley via hossman) + Changes in runtime behavior 1. Highlighting using DisMax will only pick up terms from the main user query, not boost or filter queries (klaas). diff --git a/example/solr/conf/solrconfig.xml b/example/solr/conf/solrconfig.xml index b7ee00116fc..8d435a9b790 100755 --- a/example/solr/conf/solrconfig.xml +++ b/example/solr/conf/solrconfig.xml @@ -270,6 +270,7 @@ 2<-1 5<-2 6<90% 100 + *:* diff --git a/src/java/org/apache/solr/request/DisMaxRequestHandler.java b/src/java/org/apache/solr/request/DisMaxRequestHandler.java index ccb43292c84..6a9dec4c2b0 100644 --- a/src/java/org/apache/solr/request/DisMaxRequestHandler.java +++ b/src/java/org/apache/solr/request/DisMaxRequestHandler.java @@ -30,6 +30,7 @@ import java.util.Map; import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; +import org.apache.lucene.search.MatchAllDocsQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.BooleanClause.Occur; import org.apache.solr.core.SolrCore; @@ -60,6 +61,12 @@ import org.apache.solr.util.SolrPluginUtils; *

* *