Skip to content

Commit

Permalink
fts-solr: Changed default operator to AND to fix multi-word queries.
Browse files Browse the repository at this point in the history
Previously for example searching from:foo@example.com was expanded to
foo OR example OR com. Now it's foo AND example AND com, which makes a lot
more sense.
  • Loading branch information
sirainen committed Jan 26, 2016
1 parent 1ac936b commit f3b0efd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/plugins/fts-solr/fts-backend-solr-old.c
Expand Up @@ -699,7 +699,7 @@ fts_backend_solr_lookup(struct fts_backend *_backend, struct mailbox *box,
&status);

str = t_str_new(256);
str_printfa(str, "fl=uid,score&rows=%u&sort=uid+asc&q=",
str_printfa(str, "fl=uid,score&rows=%u&sort=uid+asc&q={!lucene+q.op%%3dAND}",
status.uidnext);

if (!solr_add_definite_query_args(str, args, and_args)) {
Expand Down Expand Up @@ -832,7 +832,7 @@ fts_backend_solr_lookup_multi(struct fts_backend *_backend,
fts_solr_set_default_ns(backend);

str = t_str_new(256);
str_printfa(str, "fl=ns,box,uidv,uid,score&rows=%u&sort=box+asc,uid+asc&q=",
str_printfa(str, "fl=ns,box,uidv,uid,score&rows=%u&sort=box+asc,uid+asc&q={!lucene+q.op%%3dAND}",
SOLR_MAX_MULTI_ROWS);

if (solr_add_definite_query_args(str, args, and_args)) {
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/fts-solr/fts-backend-solr.c
Expand Up @@ -822,7 +822,7 @@ fts_backend_solr_lookup(struct fts_backend *_backend, struct mailbox *box,
mailbox_get_open_status(box, STATUS_UIDNEXT, &status);

str = t_str_new(256);
str_printfa(str, "fl=uid,score&rows=%u&sort=uid+asc&q=",
str_printfa(str, "fl=uid,score&rows=%u&sort=uid+asc&q={!lucene+q.op%%3dAND}",
status.uidnext);
prefix_len = str_len(str);

Expand Down Expand Up @@ -931,7 +931,7 @@ fts_backend_solr_lookup_multi(struct fts_backend *backend,
string_t *str;

str = t_str_new(256);
str_printfa(str, "fl=box,uid,score&rows=%u&sort=box+asc,uid+asc&q=",
str_printfa(str, "fl=box,uid,score&rows=%u&sort=box+asc,uid+asc&q={!lucene+q.op%%3dAND}",
SOLR_MAX_MULTI_ROWS);

if (solr_add_definite_query_args(str, args, and_args)) {
Expand Down

0 comments on commit f3b0efd

Please sign in to comment.