I'm trying to understand how to make a userInput() work, with the minimum of settings. I could not retrieve results for keyword "product", even with "product 1" in some document titles. I simplified the query and settings to the bare minimum. Filters and aggregations work fine.
The field definition, without any ranking, fieldset, ...:
field wpsolr_title type string {
indexing: summary | index
}
The field content in a document:
The query:
{"userQuery":"product","yql":"select * from wpsolr1 where (userInput(@userQuery))"}
Since you're not specifying the index, terms in the user query will by default search default
so the parsed query here becomes
select * from wpsolr1 where weakAnd(default contains "product")
You need to either put the fields you want users to search by default into a fieldset called "default":
fieldset default { # in schema, outside the document block
fields: wpsolr_title, my_other_field, ...
}
or specify the default field or fieldset to be used for the user query:
select * from wpsolr1 where {defaultIndex:"wpsolr_title"}userInput(@userQuery)
Tip: You can always see the query that is produced by passing tracelevel=1 as a HTTP parameter.