Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching all solr fields for value

Tags:

solr

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?

like image 675
eithed Avatar asked Aug 12 '16 14:08

eithed


People also ask

How do I search a specific field in Solr?

If you do not specify a field in a query, Solr searches only the default field. Alternatively, you can specify a different field or a combination of fields in a query. To specify a field, type the field name followed by a colon ":" and then the term you are searching for within the field.

How do I query a collection in Solr?

You can search for "solr" by loading the Admin UI Query tab, enter "solr" in the q param (replacing *:* , which matches all documents), and "Execute Query". See the Searching section below for more information. To index your own data, re-run the directory indexing command pointed to your own directory of documents.

What is full text search in Solr?

Searching is the most powerful capability of Solr. Once we have the documents indexed in our repository, we can search for keywords, phrases, date ranges, etc. The results are sorted by relevance (score).


1 Answers

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.

like image 56
Alexandre Rafalovitch Avatar answered Sep 29 '22 14:09

Alexandre Rafalovitch