Author: tommaso
Date: Mon Nov 16 12:06:24 2015
New Revision: 1714568
URL: http://svn.apache.org/viewvc?rev=1714568&view=rev
Log:
OAK-3331, OAK-3641 - fixed multiple word spellcheck config
Removed:
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/resources/org/apache/jackrabbit/oak/query/sql1.txt
Modified:
jackrabbit/oak/branches/1.0/oak-solr-core/src/main/resources/solr/oak/conf/schema.xml
jackrabbit/oak/branches/1.0/oak-solr-core/src/main/resources/solr/oak/conf/solrconfig.xml
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/jcr/query/SpellcheckTest.java
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/resources/solr/oak/conf/solrconfig.xml
Modified:
jackrabbit/oak/branches/1.0/oak-solr-core/src/main/resources/solr/oak/conf/schema.xml
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-solr-core/src/main/resources/solr/oak/conf/schema.xml?rev=1714568&r1=1714567&r2=1714568&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.0/oak-solr-core/src/main/resources/solr/oak/conf/schema.xml
(original)
+++
jackrabbit/oak/branches/1.0/oak-solr-core/src/main/resources/solr/oak/conf/schema.xml
Mon Nov 16 12:06:24 2015
@@ -79,6 +79,18 @@
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
+ <fieldtype name="spellcheck" class="solr.TextField">
+ <analyzer type="index">
+ <tokenizer class="solr.ClassicTokenizerFactory"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ <filter class="solr.ShingleFilterFactory" minShingleSize="2"
maxShingleSize="3"
+ outputUnigrams="true"
outputUnigramsIfNoShingles="true" tokenSeparator=" " fillerToken="*"/>
+ </analyzer>
+ <analyzer type="query">
+ <tokenizer class="solr.KeywordTokenizerFactory"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldtype>
<fieldType name="boolean" class="solr.BoolField"
sortMissingLast="true"/>
@@ -118,6 +130,7 @@
<field name=":indexed" type="tdate" indexed="true" stored="false"
default="NOW" docValues="true"/>
<field name=":suggest-weight" type="tint" indexed="false"
stored="false" default="1" docValues="true"/>
<field name=":suggest" type="string" indexed="true" stored="true"
multiValued="true" />
+ <field name=":spellcheck" type="spellcheck" indexed="true"
stored="false" multiValued="true" />
<field name="path_collapsed" type="string" indexed="true"
stored="false"/>
<field name="path_depth" type="tint" indexed="true" stored="false"/>
<field name="_version_" type="long" indexed="true" stored="true"/>
@@ -136,6 +149,8 @@
<copyField source="path_exact" dest="path_child"/>
<copyField source="path_exact" dest=":path"/>
<copyField source="*" dest="catch_all"/>
+ <copyField source="jcr:title" dest=":spellcheck"/>
+ <copyField source="jcr:description" dest=":spellcheck"/>
<copyField source="jcr:title" dest=":suggest"/>
<copyField source="jcr:description" dest=":suggest"/>
Modified:
jackrabbit/oak/branches/1.0/oak-solr-core/src/main/resources/solr/oak/conf/solrconfig.xml
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-solr-core/src/main/resources/solr/oak/conf/solrconfig.xml?rev=1714568&r1=1714567&r2=1714568&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.0/oak-solr-core/src/main/resources/solr/oak/conf/solrconfig.xml
(original)
+++
jackrabbit/oak/branches/1.0/oak-solr-core/src/main/resources/solr/oak/conf/solrconfig.xml
Mon Nov 16 12:06:24 2015
@@ -1191,13 +1191,14 @@
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
- <str name="queryAnalyzerFieldType">text_general</str>
+ <str name="queryAnalyzerFieldType">spellcheck</str>
<!-- a spellchecker built from a field of the main index -->
<lst name="spellchecker">
<str name="name">default</str>
- <str name="field">catch_all</str>
+ <str name="field">:spellcheck</str>
<str name="classname">solr.DirectSolrSpellChecker</str>
+ <!-- the spellcheck distance measure used, the default is the
internal levenshtein -->
<str name="distanceMeasure">internal</str>
<!-- minimum accuracy needed to be considered a valid spellcheck
suggestion -->
<float name="accuracy">0.5</float>
Modified:
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/jcr/query/SpellcheckTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/jcr/query/SpellcheckTest.java?rev=1714568&r1=1714567&r2=1714568&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/jcr/query/SpellcheckTest.java
(original)
+++
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/jcr/query/SpellcheckTest.java
Mon Nov 16 12:06:24 2015
@@ -38,9 +38,9 @@ public class SpellcheckTest extends Abst
Session session = superuser;
QueryManager qm = session.getWorkspace().getQueryManager();
Node n1 = testRootNode.addNode("node1");
- n1.setProperty("text", "hello hello hello alt");
+ n1.setProperty("jcr:title", "hello hello hello alt");
Node n2 = testRootNode.addNode("node2");
- n2.setProperty("text", "hold");
+ n2.setProperty("jcr:title", "hold");
session.save();
String sql = "SELECT [rep:spellcheck()] FROM nt:base WHERE [jcr:path]
= '/' AND SPELLCHECK('helo')";
@@ -54,9 +54,9 @@ public class SpellcheckTest extends Abst
Session session = superuser;
QueryManager qm = session.getWorkspace().getQueryManager();
Node n1 = testRootNode.addNode("node1");
- n1.setProperty("text", "hello hello hello alt");
+ n1.setProperty("jcr:title", "hello hello hello alt");
Node n2 = testRootNode.addNode("node2");
- n2.setProperty("text", "hold");
+ n2.setProperty("jcr:title", "hold");
session.save();
String xpath = "/jcr:root[rep:spellcheck('helo')]/(rep:spellcheck())";
Modified:
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml?rev=1714568&r1=1714567&r2=1714568&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml
(original)
+++
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml
Mon Nov 16 12:06:24 2015
@@ -77,6 +77,18 @@
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
+ <fieldtype name="spellcheck" class="solr.TextField">
+ <analyzer type="index">
+ <tokenizer class="solr.ClassicTokenizerFactory"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ <filter class="solr.ShingleFilterFactory" minShingleSize="2"
maxShingleSize="3"
+ outputUnigrams="true"
outputUnigramsIfNoShingles="true" tokenSeparator=" " fillerToken="*"/>
+ </analyzer>
+ <analyzer type="query">
+ <tokenizer class="solr.KeywordTokenizerFactory"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldtype>
<fieldType name="boolean" class="solr.BoolField"
sortMissingLast="true"/>
@@ -122,6 +134,7 @@
<field name=":indexed" type="tdate" indexed="true" stored="false"
default="NOW" docValues="true"/>
<field name=":suggest-weight" type="tint" indexed="false"
stored="false" default="1" docValues="true"/>
<field name=":suggest" type="string" indexed="true" stored="true"
multiValued="true" />
+ <field name=":spellcheck" type="spellcheck" indexed="true"
stored="false" multiValued="true" />
<field name="path_collapsed" type="string" indexed="true"
stored="true"/>
<field name="path_depth" type="tint" indexed="true" stored="false"/>
<field name="_version_" type="long" indexed="true" stored="true"/>
@@ -139,6 +152,8 @@
<copyField source="path_exact" dest="path_child"/>
<copyField source="path_exact" dest=":path"/>
<copyField source="*" dest="catch_all"/>
+ <copyField source="jcr:title" dest=":spellcheck"/>
+ <copyField source="jcr:description" dest=":spellcheck"/>
<copyField source="jcr:title" dest=":suggest"/>
<copyField source="jcr:description" dest=":suggest"/>
</schema>
Modified:
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/resources/solr/oak/conf/solrconfig.xml
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-solr-core/src/test/resources/solr/oak/conf/solrconfig.xml?rev=1714568&r1=1714567&r2=1714568&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/resources/solr/oak/conf/solrconfig.xml
(original)
+++
jackrabbit/oak/branches/1.0/oak-solr-core/src/test/resources/solr/oak/conf/solrconfig.xml
Mon Nov 16 12:06:24 2015
@@ -1221,16 +1221,12 @@ current implementation relies on the upd
-->
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
- <str name="queryAnalyzerFieldType">text_general</str>
-
- <!-- Multiple "Spell Checkers" can be declared and used by this
- component
- -->
+ <str name="queryAnalyzerFieldType">spellcheck</str>
<!-- a spellchecker built from a field of the main index -->
<lst name="spellchecker">
<str name="name">default</str>
- <str name="field">catch_all</str>
+ <str name="field">:spellcheck</str>
<str name="classname">solr.DirectSolrSpellChecker</str>
<!-- the spellcheck distance measure used, the default is the
internal levenshtein -->
<str name="distanceMeasure">internal</str>
@@ -1246,19 +1242,18 @@ current implementation relies on the upd
<int name="minQueryLength">4</int>
<!-- maximum threshold of documents a query term can appear to be
considered for correction -->
<float name="maxQueryFrequency">0.01</float>
- <str name="buildOnCommit">true</str>
</lst>
<!-- a spellchecker that can break or combine words. See "/spell"
handler below for usage -->
- <lst name="spellchecker">
- <str name="name">wordbreak</str>
- <str name="classname">solr.WordBreakSolrSpellChecker</str>
- <str name="field">name</str>
- <str name="combineWords">true</str>
- <str name="breakWords">true</str>
- <int name="maxChanges">10</int>
- <str name="buildOnCommit">true</str>
- </lst>
+ <!--<lst name="spellchecker">-->
+ <!--<str name="name">wordbreak</str>-->
+ <!--<str name="classname">solr.WordBreakSolrSpellChecker</str>-->
+ <!--<str name="field">name</str>-->
+ <!--<str name="combineWords">true</str>-->
+ <!--<str name="breakWords">true</str>-->
+ <!--<int name="maxChanges">10</int>-->
+ <!--<str name="buildOnCommit">true</str>-->
+ <!--</lst>-->
<!-- a spellchecker that uses a different distance measure -->
<!--
@@ -1314,13 +1309,12 @@ current implementation relies on the upd
-->
<requestHandler name="/spellcheck" class="solr.SearchHandler"
startup="lazy">
<lst name="defaults">
- <str name="df">catch_all</str>
+ <!--<str name="df">catch_all</str>-->
<!-- Solr will use suggestions from both the 'default' spellchecker
and from the 'wordbreak' spellchecker and combine them.
collations (re-written queries) can include a combination of
corrections from both spellcheckers -->
<str name="spellcheck.dictionary">default</str>
- <str name="spellcheck.dictionary">wordbreak</str>
<str name="spellcheck">on</str>
<str name="spellcheck.extendedResults">true</str>
<str name="spellcheck.count">10</str>