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
917fc7d8
Commit
917fc7d8
authored
May 08, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19 from shieldo/clear_documents
Clear documents
parents
666bf48d
2a6f316f
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 @
917fc7d8
...
...
@@ -202,6 +202,17 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly
return
$this
->
_boost
;
}
/**
* Clear all fields
*
* @return void
**/
public
function
clear
()
{
$this
->
_fields
=
array
();
$this
->
_fieldBoosts
=
array
();
}
/**
* Set field value
*
...
...
tests/Solarium/Document/ReadWriteTest.php
View file @
917fc7d8
...
...
@@ -272,5 +272,30 @@ class Solarium_Document_ReadWriteTest extends PHPUnit_Framework_TestCase
$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