Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
2a6f316f
Commit
2a6f316f
authored
May 06, 2011
by
Douglas Greenshields
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added clear method for readwrite documents for easy clearing of fields and boosts
parent
a41cc287
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
library/Solarium/Document/ReadWrite.php
library/Solarium/Document/ReadWrite.php
+11
-0
tests/Solarium/Document/ReadWriteTest.php
tests/Solarium/Document/ReadWriteTest.php
+25
-0
No files found.
library/Solarium/Document/ReadWrite.php
View file @
2a6f316f
...
@@ -202,6 +202,17 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly
...
@@ -202,6 +202,17 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly
return
$this
->
_boost
;
return
$this
->
_boost
;
}
}
/**
* Clear all fields
*
* @return void
**/
public
function
clear
()
{
$this
->
_fields
=
array
();
$this
->
_fieldBoosts
=
array
();
}
/**
/**
* Set field value
* Set field value
*
*
...
...
tests/Solarium/Document/ReadWriteTest.php
View file @
2a6f316f
...
@@ -272,5 +272,30 @@ class Solarium_Document_ReadWriteTest extends PHPUnit_Framework_TestCase
...
@@ -272,5 +272,30 @@ class Solarium_Document_ReadWriteTest extends PHPUnit_Framework_TestCase
$this
->
_doc
->
getFields
()
$this
->
_doc
->
getFields
()
);
);
}
}
public
function
testClearFields
()
{
$this
->
_doc
->
clear
();
$expectedFields
=
array
();
$this
->
assertEquals
(
$expectedFields
,
$this
->
_doc
->
getFields
()
);
}
public
function
testClearFieldsBoostRemoval
()
{
$this
->
_doc
->
setFieldBoost
(
'name'
,
3.2
);
$this
->
_doc
->
clear
();
$expectedFields
=
array
();
$this
->
assertEquals
(
null
,
$this
->
_doc
->
getFieldBoost
(
'name'
)
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment