Author: rande
Date: 2010-02-19 16:43:31 +0100 (Fri, 19 Feb 2010)
New Revision: 28141

Modified:
   plugins/sfSolrPlugin/branches/sf1.2/README
   
plugins/sfSolrPlugin/branches/sf1.2/lib/config/sfLuceneProjectConfigHandler.class.php
   plugins/sfSolrPlugin/branches/sf1.2/lib/task/sfLuceneCreateSolrTask.class.php
   plugins/sfSolrPlugin/branches/sf1.2/test/data/configTest/project.yml
   
plugins/sfSolrPlugin/branches/sf1.2/test/unit/config/sfLuceneProjectConfigHandlerTest.php
Log:
[sfSolrPlugin] add omitNorms option in search.yml file

Modified: plugins/sfSolrPlugin/branches/sf1.2/README
===================================================================
--- plugins/sfSolrPlugin/branches/sf1.2/README  2010-02-19 14:09:08 UTC (rev 
28140)
+++ plugins/sfSolrPlugin/branches/sf1.2/README  2010-02-19 15:43:31 UTC (rev 
28141)
@@ -134,11 +134,13 @@
               alias: getFullName
             p_full_name:
               stored: true
+              boost: 3        # set the boost and enable omitNorms
               alias: getFullName
             p_description:
               stored: true
               transform: strip_tags
               alias: getDescription
+              omitNorms: false # enable boost
             location_latitude:
               type: tfloat
               stored: false

Modified: 
plugins/sfSolrPlugin/branches/sf1.2/lib/config/sfLuceneProjectConfigHandler.class.php
===================================================================
--- 
plugins/sfSolrPlugin/branches/sf1.2/lib/config/sfLuceneProjectConfigHandler.class.php
       2010-02-19 14:09:08 UTC (rev 28140)
+++ 
plugins/sfSolrPlugin/branches/sf1.2/lib/config/sfLuceneProjectConfigHandler.class.php
       2010-02-19 15:43:31 UTC (rev 28141)
@@ -94,7 +94,7 @@
               $transform    = isset($field['transform']) ? $field['transform'] 
: null;
               $default      = isset($field['default']) ? $field['default'] : 
null;
               $alias        = isset($field['alias']) ? $field['alias'] : null;
-              
+              $omitNorms    = isset($field['omitNorms']) ? $field['omitNorms'] 
: ($boost !== null ? false : null);
             }
             elseif (empty($field))
             {
@@ -106,11 +106,12 @@
             }
 
             $type         = $type ? $type : 'text';
-            $boost        = $boost ? $boost : 1.0;
+            $boost        = $boost ? $boost : null;
             $transform    = $transform || count($transform) ? $transform : 
null;
             $multi_valued = $multi_valued ? $multi_valued : false;
             $stored       = $stored ? $stored : false;
             $required     = $required ? $required : false;
+            $omitNorms    = $omitNorms === null ? null : $omitNorms;
             
             $field = array(
               'type'      => $type,
@@ -120,7 +121,8 @@
               'required'  => $required,
               'stored'    => $stored,
               'default'   => $default,
-              'alias'     => $alias
+              'alias'     => $alias,
+              'omitNorms' => $omitNorms,
             );
           }
         }

Modified: 
plugins/sfSolrPlugin/branches/sf1.2/lib/task/sfLuceneCreateSolrTask.class.php
===================================================================
--- 
plugins/sfSolrPlugin/branches/sf1.2/lib/task/sfLuceneCreateSolrTask.class.php   
    2010-02-19 14:09:08 UTC (rev 28140)
+++ 
plugins/sfSolrPlugin/branches/sf1.2/lib/task/sfLuceneCreateSolrTask.class.php   
    2010-02-19 15:43:31 UTC (rev 28141)
@@ -96,12 +96,13 @@
           foreach($model['fields'] as $field_name => $field_option)
           {
             
-            $schema_options[$field_name] = sprintf("<field name='%s' type='%s' 
stored='%s' multiValued='%s' required='%s' %s/>",
+            $schema_options[$field_name] = sprintf("<field name='%s' type='%s' 
stored='%s' multiValued='%s' required='%s' %s %s/>",
               $field_name,
               $field_option['type'],
               $field_option['stored'] ? 'true' : 'false',
               $field_option['multiValued'] ? 'true' : 'false',
               $field_option['required'] ? 'true' : 'false',
+              !is_null($field_option['omitNorms']) ? 
'omitNorms=\''.($field_option['omitNorms'] ? 'true' : 'false').'\'' : '',
               !is_null($field_option['default']) ? 
'default=\''.$field_option['default'].'\'' : ''
             );
             

Modified: plugins/sfSolrPlugin/branches/sf1.2/test/data/configTest/project.yml
===================================================================
--- plugins/sfSolrPlugin/branches/sf1.2/test/data/configTest/project.yml        
2010-02-19 14:09:08 UTC (rev 28140)
+++ plugins/sfSolrPlugin/branches/sf1.2/test/data/configTest/project.yml        
2010-02-19 15:43:31 UTC (rev 28141)
@@ -3,7 +3,9 @@
     FakeModel:
       fields:
         id:
-        title: text
+        title: 
+          type: text
+          omitNorms: true
         description:
           type: text
           boost: 3
@@ -18,8 +20,6 @@
   index:
     encoding: UTF-8
     cultures: [en, fr]
-    stop_words: [and, the]
-    short_words: 2
     analyzer: 'utf8num'
     case_sensitive: false
     mb_string: true

Modified: 
plugins/sfSolrPlugin/branches/sf1.2/test/unit/config/sfLuceneProjectConfigHandlerTest.php
===================================================================
--- 
plugins/sfSolrPlugin/branches/sf1.2/test/unit/config/sfLuceneProjectConfigHandlerTest.php
   2010-02-19 14:09:08 UTC (rev 28140)
+++ 
plugins/sfSolrPlugin/branches/sf1.2/test/unit/config/sfLuceneProjectConfigHandlerTest.php
   2010-02-19 15:43:31 UTC (rev 28141)
@@ -41,24 +41,26 @@
           'id' =>
           array (
             'type' => 'text',
-            'boost' => 1,
+            'boost' => null,
             'transform' => NULL,
             'multiValued' => false,
             'required' => false,
             'stored'   => false,
             'default' => null,
             'alias' => NULL,
+            'omitNorms' => NULL,
           ),
           'title' =>
           array (
             'type' => 'text',
-            'boost' => 1,
+            'boost' => null,
             'transform' => NULL,
             'multiValued' => false,
             'required' => false,
             'stored'   => false,
             'default' => null,
             'alias' => NULL,
+            'omitNorms' => true,
           ),
           'description' =>
           array (
@@ -70,6 +72,7 @@
             'stored'   => false,
             'default' => null,
             'alias' => NULL,
+            'omitNorms' => false,
           ),
         ),
         'title' => 'title',

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to