Changed the query processed by the highlighter for DisMax: instead of using the whole query

(which included boost and filter terms), the highlighting will be limited to the user's query 
terms by default.

 --This line, and those below, will be ignored--

M    CHANGES.txt
M    src/java/org/apache/solr/request/DisMaxRequestHandler.java


git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@492793 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mike Klaas 2007-01-04 22:47:54 +00:00
parent 5bc0a3b009
commit 4202fc353f
2 changed files with 8 additions and 13 deletions

View File

@ -38,7 +38,8 @@ New Features
1.
Changes in runtime behavior
1.
1. Highlighting using DisMax will only pick up terms from the main
user query, not boost or filter queries (klaas).
Optimizations
1.

View File

@ -268,19 +268,16 @@ public class DisMaxRequestHandler
BooleanQuery query = new BooleanQuery(true);
String minShouldMatch = params.get(DMP.MM, "100%");
Query dis = up.parse(userQuery);
Query parsedUserQuery = dis;
if (dis instanceof BooleanQuery) {
BooleanQuery t = new BooleanQuery();
U.flattenBooleanQuery(t, (BooleanQuery)dis);
U.setMinShouldMatch(t, minShouldMatch);
query.add(t, Occur.MUST);
} else {
query.add(dis, Occur.MUST);
parsedUserQuery = t;
}
query.add(parsedUserQuery, Occur.MUST);
/* * * Add on Phrases for the Query * * */
@ -381,12 +378,9 @@ public class DisMaxRequestHandler
/* * * Highlighting/Summarizing * * */
if(HighlightingUtils.isHighlightingEnabled(req)) {
BooleanQuery highlightQuery = new BooleanQuery();
U.flattenBooleanQuery(highlightQuery, query);
String[] highFields = queryFields.keySet().toArray(new String[0]);
NamedList sumData =
HighlightingUtils.doHighlighting(results.docList, highlightQuery,
HighlightingUtils.doHighlighting(results.docList, parsedUserQuery,
req, highFields);
if(sumData != null)
rsp.add("highlighting", sumData);