Reputation: 5237
I have imported docs into Solr that have fields dynamically created from a pattern (mostly *_s). In the back-end (/solr/admin), I can see that they exist: the aggregate stats, like term frequency, appear correctly. They are all listed as indexed & stored.
However, they do not appear in queries, even when I search across all fields, for example:
/solr/select/?indent=on&q=myterms&fl=*
This problem seems similar to SOLR not searching on certain fields, and I tried the solution there, which was:
If you want your standard query handler to search against all your fields you can change it in your solrconfig.xml (I always add a second query handler instead of modifying "standard". The fl field is the list of fields you want to search against. It's a comma separated list or *.
I made that change to the standard solrconfig.xml, but still get no results.
I tried creating a very simple doc:
{'id':5, 'name':'foo'}
And this query returns that doc:
/solr/select/?indent=on&q=foo&fl=*
The whole results of a query with no results read:
<response>
−
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1</int>
−
<lst name="params">
<str name="echoParams">all</str>
<str name="h1">true</str>
<str name="defType">dismax</str>
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">Foo</str>
<str name="version">2.2</str>
<str name="rows">10</str>
</lst>
</lst>
<result name="response" numFound="0" start="0"/>
</response>
Upvotes: 1
Views: 2604
Reputation: 4082
Since you're using _s
you can copy those fields to "text" in solr/collection1/conf/schema.xml
like this:
<copyField source="*_s" dest="text" maxChars="3000"/>
It's a slight variation the solution at Why do dynamic fields not act like normal fields (specifically when querying and displaying in Hue) in solr? which was to uncomment this *_t
line:
<!-- Above, multiple source fields are copied to the [text] field.
Another way to map multiple source fields to the same
destination field is to use the dynamic field syntax.
copyField also supports a maxChars to copy setting. -->
<!-- <copyField source="*_t" dest="text" maxChars="3000"/> -->
This made my dynamic fields searchable with:
curl http://localhost:8983/solr/collection1/select?q=foo
Here's where the "catchall" text
field is described:
<!-- catchall field, containing all other searchable text fields (implemented
via copyField further on in this schema -->
<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
See also http://wiki.apache.org/solr/SchemaXml#Copy_Fields
Upvotes: 2
Reputation: 551
I see your using the query "Foo" while the name
value is "foo". You might wanna check if you lowercase terms in de index and query in your schema for the fieldtype you are using for name
.
Upvotes: 0
Reputation: 6928
Is the deftype of your "standard" query handler is dismax? If not, then it won't work. As the answer to the question you provided says, you have to use dismax to search in multiple fields. If you do not want to use dismax and still want to search in many fields at once, you have to use the copy fields feature at index time to gather all the fields you want to search on into one field, and then make that field your default field.
Upvotes: 3