changeset 9141:d21bd1a1710a HEAD

solr: Don't use "any" copyfield, it doubles the index size.
author Timo Sirainen <tss@iki.fi>
date Wed, 17 Jun 2009 12:44:33 -0400
parents fd2869cf92fd
children 5ee5def4f0ff
files doc/solr-schema.xml src/plugins/fts-solr/fts-backend-solr.c
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/doc/solr-schema.xml	Tue Jun 16 18:55:34 2009 -0400
+++ b/doc/solr-schema.xml	Wed Jun 17 12:44:33 2009 -0400
@@ -50,9 +50,6 @@
    <field name="any" type="text" indexed="true" stored="false" multiValued="true" />
  </fields>
 
- <copyField source="hdr" dest="any" />
- <copyField source="body" dest="any" />
-
  <uniqueKey>id</uniqueKey>
  <defaultSearchField>any</defaultSearchField>
  <solrQueryParser defaultOperator="AND" />
--- a/src/plugins/fts-solr/fts-backend-solr.c	Tue Jun 16 18:55:34 2009 -0400
+++ b/src/plugins/fts-solr/fts-backend-solr.c	Wed Jun 17 12:44:33 2009 -0400
@@ -750,14 +750,19 @@
 			/* body only */
 			i_assert((fields[i].flags & FTS_LOOKUP_FLAG_BODY) != 0);
 			str_append(str, "body:");
+			solr_quote_http(str, fields[i].key);
 		} else if ((fields[i].flags & FTS_LOOKUP_FLAG_BODY) == 0) {
 			/* header only */
 			str_append(str, "hdr:");
+			solr_quote_http(str, fields[i].key);
 		} else {
 			/* both */
-			str_append(str, "any:");
+			str_append(str, "(body:");
+			solr_quote_http(str, fields[i].key);
+			str_append(str, "+OR+hdr:");
+			solr_quote_http(str, fields[i].key);
+			str_append_c(str, ')');
 		}
-		solr_quote_http(str, fields[i].key);
 	}
 
 	/* use a separate filter query for selecting the mailbox. it shouldn't