Solr

Joan Moreau jom at grosjo.net
Sat Dec 8 18:26:59 EET 2018


After some testsing, I managed to get proper functionning 

- The schema.xml is attached below (quite different from the one
provided on teh wiki) (in bold the core differences) (NGramFilterFactory
is the class that replace the fts_squat "partial=3 full=15", everything
else is just a big hammer to smash a tiny fly) 

- One need to remove the "managed-schema" file in the
{prefix}/server/solr/dovecot/conf. 

- One need to remove everything under {prefix}/server/solr/dovecot/data/

- The {prefix}/server/solr/dovecot/conf/solrconfig.xml is as below (see
diff) 

- my dovecot.conf is : 

fts = solr
fts_autoindex = yes
fts_enforced = yes
fts_decoder = decode2text 

fts_solr = url=http://(SOLR SERVER):8983/solr/dovecot/ 

--- schema.xml 

<?xml version="1.0" encoding="UTF-8"?>
<schema name="dovecot" version="2.0">
<uniqueKey>id</uniqueKey>

<FIELDTYPE NAME="STRING" CLASS="SOLR.STRFIELD" />
<FIELDTYPE NAME="LONG" CLASS="SOLR.TRIELONGFIELD" />
<FIELDTYPE NAME="BOOLEAN" CLASS="SOLR.BOOLFIELD" />
<fieldType name="text" class="solr.TextField"
autoGeneratePhraseQueries="true" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt"
ignoreCase="true"/>
<filter class="solr.WordDelimiterGraphFilterFactory"
generateWordParts="1" generateNumberParts="1" splitOnCaseChange="1"
splitOnNumerics="1" catenateWords="1" catenateNumbers="1"
catenateAll="1"/>
<filter class="solr.FlattenGraphFilterFactory"/> <!-- required on index
analyzers after graph filters -->
<filter class="solr.LowerCaseFilterFactory"/>
<FILTER CLASS="SOLR.NGRAMFILTERFACTORY" MINGRAMSIZE="3" MAXGRAMSIZE="15"
/>
<filter class="solr.KeywordMarkerFilterFactory"
protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.SynonymGraphFilterFactory" expand="true"
ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.FlattenGraphFilterFactory"/> <!-- required on index
analyzers after graph filters -->
<filter class="solr.StopFilterFactory" words="stopwords.txt"
ignoreCase="true"/>
<filter class="solr.WordDelimiterGraphFilterFactory"
generateWordParts="1" generateNumberParts="1" splitOnCaseChange="1"
splitOnNumerics="1" catenateWords="1" catenateNumbers="1"
catenateAll="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<FILTER CLASS="SOLR.NGRAMFILTERFACTORY" MINGRAMSIZE="3" MAXGRAMSIZE="15"
/>
<filter class="solr.KeywordMarkerFilterFactory"
protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>

<field name="_version_" type="long" indexed="true" stored="true"/>
<field name="bcc" type="text" indexed="true" stored="false"/>
<field name="body" type="text" indexed="true" stored="false"/>
<field name="box" type="string" indexed="true" required="true"
stored="true"/>
<field name="cc" type="text" indexed="true" stored="false"/>
<field name="from" type="text" indexed="true" stored="false"/>
<field name="hdr" type="text" indexed="true" stored="false"/>
<field name="id" type="string" indexed="true" required="true"
stored="true"/>
<field name="subject" type="text" indexed="true" stored="false"/>
<field name="to" type="text" indexed="true" stored="false"/>
<field name="uid" type="long" indexed="true" required="true"
stored="true"/>
<field name="user" type="string" indexed="true" required="true"
stored="true"/>
</schema> 

------ diff solrconfig 

--- /data/backup/solr/solrconfig.xml.joan 2018-12-08 14:31:47.716344505
+0000
+++ solrconfig.xml 2018-12-08 15:36:28.948267225 +0000
@@ -1128,6 +1128,7 @@

See http://wiki.apache.org/solr/GuessingFieldTypes
-->
+ <schemaFactory class="ClassicIndexSchemaFactory"></schemaFactory>
<updateProcessor class="solr.UUIDUpdateProcessorFactory" name="uuid"/>
<updateProcessor class="solr.RemoveBlankFieldUpdateProcessorFactory"
name="remove-blank"/>
<updateProcessor class="solr.FieldNameMutatingUpdateProcessorFactory"
name="field-name-mutating">
@@ -1158,43 +1159,8 @@
<str>yyyy-MM-dd</str>
</arr>
</updateProcessor>
- <updateProcessor class="solr.AddSchemaFieldsUpdateProcessorFactory"
name="add-schema-fields">
- <lst name="typeMapping">
- <str name="valueClass">java.lang.String</str>
- <str name="fieldType">text_general</str>
- <lst name="copyField">
- <str name="dest">*_str</str>
- <int name="maxChars">256</int>
- </lst>
- <!-- Use as default mapping instead of defaultFieldType -->
- <bool name="default">true</bool>
- </lst>
- <lst name="typeMapping">
- <str name="valueClass">java.lang.Boolean</str>
- <str name="fieldType">booleans</str>
- </lst>
- <lst name="typeMapping">
- <str name="valueClass">java.util.Date</str>
- <str name="fieldType">pdates</str>
- </lst>
- <lst name="typeMapping">
- <str name="valueClass">java.lang.Long</str>
- <str name="valueClass">java.lang.Integer</str>
- <str name="fieldType">plongs</str>
- </lst>
- <lst name="typeMapping">
- <str name="valueClass">java.lang.Number</str>
- <str name="fieldType">pdoubles</str>
- </lst>
- </updateProcessor>

<!-- The update.autoCreateFields property can be turned to false to
disable schemaless mode -->
- <updateRequestProcessorChain name="add-unknown-fields-to-the-schema"
default="${update.autoCreateFields:true}"
-
processor="uuid,remove-blank,field-name-mutating,parse-boolean,parse-long,parse-double,parse-date,add-schema-fields">
- <processor class="solr.LogUpdateProcessorFactory"/>
- <processor class="solr.DistributedUpdateProcessorFactory"/>
- <processor class="solr.RunUpdateProcessorFactory"/>
- </updateRequestProcessorChain>

<!-- Deduplication

@@ -1273,7 +1239,6 @@
<!-- The following response writers are implicitly configured unless
overridden...
-->
- <!--
<queryResponseWriter name="xml"
default="true"
class="solr.XMLResponseWriter" />
@@ -1284,7 +1249,6 @@
<queryResponseWriter name="phps"
class="solr.PHPSerializedResponseWriter"/>
<queryResponseWriter name="csv" class="solr.CSVResponseWriter"/>
<queryResponseWriter name="schema.xml"
class="solr.SchemaXmlResponseWriter"/>
- -->

<queryResponseWriter name="json" class="solr.JSONResponseWriter">
<!-- For the purposes of the tutorial, JSON responses are written as
@@ -1293,7 +1257,7 @@
-->
<str name="content-type">text/plain; charset=UTF-8</str>
</queryResponseWriter>
-
+ 
<!--
Custom response writers can be declared as needed...
-->
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dovecot.org/pipermail/dovecot/attachments/20181208/c88cdb8e/attachment-0001.html>


More information about the dovecot mailing list