Hairi
Hairi

Reputation: 3715

Apache solr search text search (among multiple fields)

I am studying/getting familiar Apache Solr database.

I created a simple document via the admin UI:

 {
        "company_name":["Rikotech inc"],
        "id":"12345",
        "full_title":["ft rikotech marinov"],
        "_version_":1681062832169287680}]
  }

Here is the document fetched: enter image description here

But when I type rikotech in the standard query field, I get no result: enter image description here

Both full_title and company_name are of type text_general .

I watched YouTube video with some Indian guy, and it worked for him ;|

What am I missing here?

Upvotes: 0

Views: 763

Answers (2)

Hairi
Hairi

Reputation: 3715

I found the problem.

It was that the fields I want to search through by default were copied to some strange fields like full_title_str, instad of text . This is the correct schema setting:

enter image description here

Upvotes: 0

MatsLindh
MatsLindh

Reputation: 52792

Solr will not search all fields (under any configuration, really) without specifying the fields. However, the tutorial you watched probably had the default copyField rule enabled where everything is copied into a field named _text_, and then that field is configured as the default search field. This effectively means that everything is being copied into a specific field, and then that (single) field is being searched by default.

In your case it's probably better to use the edismax query parser (check the box in front of edismax in the user interface), and then give full_title company_name as the query fields (qf). That will allow you to adjust the weights between the fields as well. full_title company_name^5 will give 5x as much weight to any hits in company_name compared to those in full_title.

Upvotes: 1

Related Questions