eithed
eithed

Reputation: 4320

Searching all solr fields for value

I want to search all fields within solr for certain value. If I search for title:six I receive my result, however if I search for *:six I don't. I've got an all field that collects information about all fields that are indexed, so if I search for all:six I do get my result as well, however I want to specifically search for *:six

In the schema.xml I've noticed a directive <copyField source="*" dest="all" /> but I don't think it's working either way (well - nothing changes if I keep it, or remove it)

Is there a way to accomplish what I'm after?

Upvotes: 12

Views: 13405

Answers (1)

Alexandre Rafalovitch
Alexandre Rafalovitch

Reputation: 9789

Search *:six is not a legal syntax and would never work as a global search. It would most likely parse as actual text instead and search the default field for that keyword instead. If the default field (defined by df parameter, most likely all) does standard tokenization, it would split on colon and search for '*' and 'six' in that default field.

So, it may have been working as a misunderstanding of Solr syntax and could have broken at any moment. If that configuration is still running, enabling the debug flag would show exactly how to the query is parsed and against which fields it is searched. That's all the proof you would need.

The correct way is the copyField you have and declaring the field all as the default search field. That's how the examples that ship with Solr out of the box do it.

Upvotes: 4

Related Questions