Solr: how do I use dismax instead of using copyField?

146 views Asked by At

I've been trying to figure this out for a bit now. If I create a schema without the directive:

<copyField source="*" dest="text" />

I can't seem to pull anything up. But when I add that directive, things magically appear. I'm trying my query with ?defType=dismax, but that doesn't seem to help.

Am I missing something? Do I need something special in my schema? I'm indexing all the fields I need to search against.

Thoughts?

Thanks!

1

There are 1 answers

0
Bruno dos Santos On

If you use defType=lucene you need to specify the field before your search query like this:

q=title:test

If you don't specify a field solr will use the default field specified in solrconfig.xml. This field is text by default. As all the fields are copied to text the search works well. If you decide to use dismax the query structure changes. You need to put your search term like that:

q=test

and specify the fields to search in other parameter like that:

<str name="qf">field1 field2</str>

Where field1 and field2 are the fields you want to search the terms.