Author: tommaso
Date: Mon Nov 16 11:54:14 2015
New Revision: 1714564

URL: http://svn.apache.org/viewvc?rev=1714564&view=rev
Log:
OAK-3640, OAK-3331 - fixed multiword spellcheck config

Removed:
    
jackrabbit/oak/branches/1.2/oak-solr-core/src/test/resources/org/apache/jackrabbit/oak/query/sql1.txt
Modified:
    
jackrabbit/oak/branches/1.2/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/jcr/query/SpellcheckTest.java
    
jackrabbit/oak/branches/1.2/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml
    
jackrabbit/oak/branches/1.2/oak-solr-core/src/test/resources/solr/oak/conf/solrconfig.xml

Modified: 
jackrabbit/oak/branches/1.2/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/jcr/query/SpellcheckTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/jcr/query/SpellcheckTest.java?rev=1714564&r1=1714563&r2=1714564&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.2/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/jcr/query/SpellcheckTest.java
 (original)
+++ 
jackrabbit/oak/branches/1.2/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/jcr/query/SpellcheckTest.java
 Mon Nov 16 11:54:14 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.2/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml?rev=1714564&r1=1714563&r2=1714564&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.2/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml
 (original)
+++ 
jackrabbit/oak/branches/1.2/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml
 Mon Nov 16 11:54:14 2015
@@ -118,6 +118,18 @@
 
         <fieldType name="currency" class="solr.CurrencyField" 
precisionStep="8" defaultCurrency="USD" currencyConfig="currency.xml" />
         <fieldtype name="ignored" stored="false" indexed="false" 
multiValued="true" class="solr.StrField"/>
+        <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>
     </types>
     <fields>
         <field name="path_exact" type="string" indexed="true" stored="true"/>
@@ -130,6 +142,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"/>
@@ -147,6 +160,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.2/oak-solr-core/src/test/resources/solr/oak/conf/solrconfig.xml
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-solr-core/src/test/resources/solr/oak/conf/solrconfig.xml?rev=1714564&r1=1714563&r2=1714564&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.2/oak-solr-core/src/test/resources/solr/oak/conf/solrconfig.xml
 (original)
+++ 
jackrabbit/oak/branches/1.2/oak-solr-core/src/test/resources/solr/oak/conf/solrconfig.xml
 Mon Nov 16 11:54:14 2015
@@ -1219,7 +1219,7 @@ current implementation relies on the upd
     -->
     <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
 
-        <str name="queryAnalyzerFieldType">text_general</str>
+        <str name="queryAnalyzerFieldType">spellcheck</str>
 
         <!-- Multiple "Spell Checkers" can be declared and used by this
            component
@@ -1228,7 +1228,7 @@ current implementation relies on the upd
         <!-- 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>
@@ -1247,15 +1247,15 @@ current implementation relies on the upd
         </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 -->
         <!--
@@ -1311,13 +1311,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>


Reply via email to