Re: Re: using the df parameter to set a default to search all fields
Eek, Shawn, you're right -- I'm sorry, all! I meant to say the the QF (!) parameter. And pasted the wrong thing too ☹ This is what ours looks like with the qf parameter (and the edismax parser) title_en^1.5 description_en^0.5 content_en^0.5 headings_en^1.3 keywords_en^1.5 url^0.5 -- Audrey Lorberfeld Data Scientist, w3 Search IBM audrey.lorberf...@ibm.com On 10/22/19, 1:50 PM, "Shawn Heisey" wrote: On 10/22/2019 11:42 AM, Audrey Lorberfeld - audrey.lorberf...@ibm.com wrote: > I think you actually can search over all fields, but not in the df parameter. We have a big list of fields we want to search over. So, we just put a dummy one in the df param field, and then we use the fl parameter. With the edismax parser, this works. It looks something like this: The fl parameter means "field list" and controls which fields are included in the search results. It does not control which fields are searched. Thanks, Shawn
Re: using the df parameter to set a default to search all fields
On 10/22/2019 11:42 AM, Audrey Lorberfeld - audrey.lorberf...@ibm.com wrote: I think you actually can search over all fields, but not in the df parameter. We have a big list of fields we want to search over. So, we just put a dummy one in the df param field, and then we use the fl parameter. With the edismax parser, this works. It looks something like this: The fl parameter means "field list" and controls which fields are included in the search results. It does not control which fields are searched. Thanks, Shawn
Re: using the df parameter to set a default to search all fields
On 10/22/2019 11:17 AM, rhys J wrote: How would I enter qf parameters in the solrconfig.xml? In the handler definition you would simply add the parameter like you did when you added df. edismax field1 field2 field3 I included the parameter in the above example that switches the query parser to edismax, which is also required when using qf. The qf parameter does not work with the default lucene query parser. You should definitely read up on edismax. It works very differently than the default parser. For most uses I would say it's better. Thanks, Shawn
Re: Re: using the df parameter to set a default to search all fields
I think you actually can search over all fields, but not in the df parameter. We have a big list of fields we want to search over. So, we just put a dummy one in the df param field, and then we use the fl parameter. With the edismax parser, this works. It looks something like this: edismax 1.0 explicit 30 content_en update_date, display_url, url, id, uid, scopes, source_id, json_payload, language, snippet, [elevated], title:title_en, description:description_en, score -- Audrey Lorberfeld Data Scientist, w3 Search IBM audrey.lorberf...@ibm.com On 10/22/19, 1:01 PM, "Shawn Heisey" wrote: On 10/22/2019 10:26 AM, rhys J wrote: > How do I make Solr search on all fields in a document? Solr does not have a way to ask for all fields on a search. If you use the edismax query parser, you can specify multiple fields with the qf parameter, but there is nothing you can put in that parameter as a shortcut for "all fields." Using qf with multiple fields is the cleanest way to do this. > I read the documentation about the df field, and added the following to my > solrconfig.xml: > > >explicit >10 > _text_ > The df parameter just means "default field". It can only search one field. > in my managed-schema file i have the following: > >stored="true"/> > > I have deleted the documents, and re-indexed the csv file. > > When I do a search in the api for: _text_:amy - which should return 2 > documents, I get nothing. Just having a field named _text_ doesn't make anything happen, unless your indexing specifically adds documents with that field defined. There is nothing special about _text_. Other field names that start and end with an underscore, like _version_ or _root_, are special ... but _text_ is not. Probably what you are looking for here is to set up one or more copyField definitions in your schema, which are configured to copy one or more of your other fields to _text_ so it can be searched as a catchall field. I find it useful to name that field "catchall" rather than something like _text_ which seems like a special field name, but isn't. Thanks, Shawn
Re: using the df parameter to set a default to search all fields
> Solr does not have a way to ask for all fields on a search. If you use > the edismax query parser, you can specify multiple fields with the qf > parameter, but there is nothing you can put in that parameter as a > shortcut for "all fields." Using qf with multiple fields is the > cleanest way to do this. > > How would I enter qf parameters in the solrconfig.xml? > Probably what you are looking for here is to set up one or more > copyField definitions in your schema, which are configured to copy one > or more of your other fields to _text_ so it can be searched as a > catchall field. I find it useful to name that field "catchall" rather > than something like _text_ which seems like a special field name, but > isn't. > I did as you suggested, and created a field called 'all_fields' and added copyFields too. I re-indexed, and this works when i do the search. Thanks Rhys
Re: using the df parameter to set a default to search all fields
On 10/22/2019 10:26 AM, rhys J wrote: How do I make Solr search on all fields in a document? Solr does not have a way to ask for all fields on a search. If you use the edismax query parser, you can specify multiple fields with the qf parameter, but there is nothing you can put in that parameter as a shortcut for "all fields." Using qf with multiple fields is the cleanest way to do this. I read the documentation about the df field, and added the following to my solrconfig.xml: explicit 10 _text_ The df parameter just means "default field". It can only search one field. in my managed-schema file i have the following: I have deleted the documents, and re-indexed the csv file. When I do a search in the api for: _text_:amy - which should return 2 documents, I get nothing. Just having a field named _text_ doesn't make anything happen, unless your indexing specifically adds documents with that field defined. There is nothing special about _text_. Other field names that start and end with an underscore, like _version_ or _root_, are special ... but _text_ is not. Probably what you are looking for here is to set up one or more copyField definitions in your schema, which are configured to copy one or more of your other fields to _text_ so it can be searched as a catchall field. I find it useful to name that field "catchall" rather than something like _text_ which seems like a special field name, but isn't. Thanks, Shawn