dovecot-1.2: solr: Don't use "any" copyfield, it doubles the ind...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 17 19:44:40 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/d21bd1a1710a
changeset: 9141:d21bd1a1710a
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 17 12:44:33 2009 -0400
description:
solr: Don't use "any" copyfield, it doubles the index size.

diffstat:

2 files changed, 7 insertions(+), 5 deletions(-)
doc/solr-schema.xml                     |    3 ---
src/plugins/fts-solr/fts-backend-solr.c |    9 +++++++--

diffs (38 lines):

diff -r fd2869cf92fd -r d21bd1a1710a doc/solr-schema.xml
--- 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 @@ want to modify the tokenizers and filter
    <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" />
diff -r fd2869cf92fd -r d21bd1a1710a src/plugins/fts-solr/fts-backend-solr.c
--- 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 @@ static int fts_backend_solr_lookup(struc
 			/* 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


More information about the dovecot-cvs mailing list