0

Let's say I'm trying to search for 'Douglas' in any field. If I just do:

solr/query?q=Douglas

I get 0 responses, but if I do:

solr/query?q=firstname:Douglas

then I do get responses, why is this? I've also tried:

solr/query?q=Douglas&qf=firstname

which still gives me nothing. How do I just do a search for all fields? Then how do I 'boost' the relevancy of some fields? For example, if I search for Douglas, then people called Douglas should come up before items with the word 'Douglas' in their description.

chiwangc
  • 3,566
  • 16
  • 26
  • 32
user3875916
  • 133
  • 2
  • 8

3 Answers3

0

You've got two concept mixed up here.

The default search goes against one field. That's the field defined by df (default field) parameter (not qf). So, solr/query?q=Douglas&df=firstname should have worked. Solr examples usually have text field set as default and copyField instructions to copy other fields into that. This works, but does not allow to use different analyzers for different fields. Nor does it allow ranking based on which field content is found in.

If you want to search multiple fields with different weights, you need to switch to dismax or edismax query parser. Then, you do use qf parameter to show which fields to search through.

You can experiment with all of that in the Solr Admin UI.

Alexandre Rafalovitch
  • 9,709
  • 1
  • 24
  • 27
0

You have to use copyfield to copy your field into text to make it searchable. In default, all fields values which wanna searchable will copy into text field. You have to add a copy field as here or here

Community
  • 1
  • 1
Kumar
  • 3,782
  • 4
  • 39
  • 87
0

To add boosts at query time:

q=(firstname:douglas)^100 OR (body:douglas)^50 OR (someField:douglas)^25

NickJHoran
  • 597
  • 4
  • 13