Why is Solr not using fieldtype analyzers when pushing simple strings?
I am trying to add html content to Solr with PECL. Unfortunately I can push content but it will not use the Analyzer types in the schema.xml
For example:
Adding content to solr:
$client = new SolrClient($options);
$doc = new SolrInputDocument();
$doc->addField('title', 'SELLING CARS');
Schema.xml for the field "title"
<field name="title" type="lowercase" indexed="true" stored="true" multiValued="true"/>
This should make sure that the string added is converted to lowercase (I presume) But when querying the index with:
$query->setQuery('*:*');
$query_response = $client->query($query);
The content is still in Uppercase?
Following output.... Any ideas what I am doing wrong???
...
[0]开发者_Go百科 => SolrObject Object ( [id] => 422 [title] => Array ( [0] => SELLING CARS ) )
Actually, the lowercase field type defined in the example schema.xml only lowercases the field when adding it to the index or for query purposes. As you can see below the lowercase type is just setup apply the LowerCaseFilterFactory when indexing or querying the data.
<!-- lowercases the entire field value, keeping it as a single token. -->
<fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
</fieldType>
Solr will not change the actual value that you input. If you truly want it to be stored in lowercase in the index, I would recommend lowercasing the value when submitting it to the index.
精彩评论