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
2acf1376
Commit
2acf1376
authored
Nov 04, 2014
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #288 from thePanz/develop
Added ExtractOnly parameter for Extractor Handler
parents
6b745330
1bed321f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
2 deletions
+30
-2
library/Solarium/QueryType/Extract/Query.php
library/Solarium/QueryType/Extract/Query.php
+20
-0
library/Solarium/QueryType/Extract/RequestBuilder.php
library/Solarium/QueryType/Extract/RequestBuilder.php
+1
-0
tests/Solarium/Tests/QueryType/Extract/QueryTest.php
tests/Solarium/Tests/QueryType/Extract/QueryTest.php
+6
-0
tests/Solarium/Tests/QueryType/Extract/RequestBuilderTest.php
...s/Solarium/Tests/QueryType/Extract/RequestBuilderTest.php
+3
-2
No files found.
library/Solarium/QueryType/Extract/Query.php
View file @
2acf1376
...
@@ -72,6 +72,7 @@ class Query extends BaseQuery
...
@@ -72,6 +72,7 @@ class Query extends BaseQuery
'resultclass'
=>
'Solarium\QueryType\Extract\Result'
,
'resultclass'
=>
'Solarium\QueryType\Extract\Result'
,
'documentclass'
=>
'Solarium\QueryType\Update\Query\Document\Document'
,
'documentclass'
=>
'Solarium\QueryType\Update\Query\Document\Document'
,
'omitheader'
=>
true
,
'omitheader'
=>
true
,
'extractonly'
=>
false
,
);
);
/**
/**
...
@@ -387,6 +388,25 @@ class Query extends BaseQuery
...
@@ -387,6 +388,25 @@ class Query extends BaseQuery
return
$this
->
getOption
(
'documentclass'
);
return
$this
->
getOption
(
'documentclass'
);
}
}
/**
* Set the ExtractOnly parameter of SOLR Extraction Handler
*
* @param bool $value
* @return self Provides fluent interface
*/
public
function
setExtractOnly
(
$value
)
{
return
$this
->
setOption
(
'extractonly'
,
(
bool
)
$value
);
}
/**
* Get the ExtractOnly parameter of SOLR Extraction Handler
*
* @return boolean
*/
public
function
getExtractOnly
()
{
return
$this
->
getOption
(
'extractonly'
);
}
/**
/**
* Create a document object instance
* Create a document object instance
*
*
...
...
library/Solarium/QueryType/Extract/RequestBuilder.php
View file @
2acf1376
...
@@ -75,6 +75,7 @@ class RequestBuilder extends BaseRequestBuilder
...
@@ -75,6 +75,7 @@ class RequestBuilder extends BaseRequestBuilder
$request
->
addParam
(
'uprefix'
,
$query
->
getUprefix
());
$request
->
addParam
(
'uprefix'
,
$query
->
getUprefix
());
$request
->
addParam
(
'lowernames'
,
$query
->
getLowernames
());
$request
->
addParam
(
'lowernames'
,
$query
->
getLowernames
());
$request
->
addParam
(
'defaultField'
,
$query
->
getDefaultField
());
$request
->
addParam
(
'defaultField'
,
$query
->
getDefaultField
());
$request
->
addParam
(
'extractOnly'
,
$query
->
getExtractOnly
());
foreach
(
$query
->
getFieldMappings
()
as
$fromField
=>
$toField
)
{
foreach
(
$query
->
getFieldMappings
()
as
$fromField
=>
$toField
)
{
$request
->
addParam
(
'fmap.'
.
$fromField
,
$toField
);
$request
->
addParam
(
'fmap.'
.
$fromField
,
$toField
);
...
...
tests/Solarium/Tests/QueryType/Extract/QueryTest.php
View file @
2acf1376
...
@@ -106,6 +106,12 @@ class QueryTest extends \PHPUnit_Framework_TestCase
...
@@ -106,6 +106,12 @@ class QueryTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
'defaulttext'
,
$this
->
query
->
getDefaultField
());
$this
->
assertEquals
(
'defaulttext'
,
$this
->
query
->
getDefaultField
());
}
}
public
function
testSetAndGetExtractOnly
()
{
$this
->
query
->
setExtractOnly
(
true
);
$this
->
assertEquals
(
true
,
$this
->
query
->
getExtractOnly
());
}
public
function
testSetAndGetLowernames
()
public
function
testSetAndGetLowernames
()
{
{
$this
->
query
->
setLowernames
(
true
);
$this
->
query
->
setLowernames
(
true
);
...
...
tests/Solarium/Tests/QueryType/Extract/RequestBuilderTest.php
View file @
2acf1376
...
@@ -78,7 +78,7 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase
...
@@ -78,7 +78,7 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase
{
{
$request
=
$this
->
builder
->
build
(
$this
->
query
);
$request
=
$this
->
builder
->
build
(
$this
->
query
);
$this
->
assertEquals
(
$this
->
assertEquals
(
'update/extract?omitHeader=true¶m1=value1&wt=json&json.nl=flat&fmap.from-field=to-field'
.
'update/extract?omitHeader=true¶m1=value1&wt=json&json.nl=flat&
extractOnly=false&
fmap.from-field=to-field'
.
'&resource.name=RequestBuilderTest.php'
,
'&resource.name=RequestBuilderTest.php'
,
$request
->
getUri
()
$request
->
getUri
()
);
);
...
@@ -90,7 +90,7 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase
...
@@ -90,7 +90,7 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase
$query
->
setFile
(
'http://solarium-project.org/'
);
$query
->
setFile
(
'http://solarium-project.org/'
);
$request
=
$this
->
builder
->
build
(
$query
);
$request
=
$this
->
builder
->
build
(
$query
);
$this
->
assertEquals
(
$this
->
assertEquals
(
'update/extract?omitHeader=true¶m1=value1&wt=json&json.nl=flat&fmap.from-field=to-field'
.
'update/extract?omitHeader=true¶m1=value1&wt=json&json.nl=flat&
extractOnly=false&
fmap.from-field=to-field'
.
'&stream.url=http%3A%2F%2Fsolarium-project.org%2F'
,
'&stream.url=http%3A%2F%2Fsolarium-project.org%2F'
,
$request
->
getUri
()
$request
->
getUri
()
);
);
...
@@ -112,6 +112,7 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase
...
@@ -112,6 +112,7 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase
'literal.field1'
=>
'value1'
,
'literal.field1'
=>
'value1'
,
'literal.field2'
=>
'value2'
,
'literal.field2'
=>
'value2'
,
'omitHeader'
=>
'true'
,
'omitHeader'
=>
'true'
,
'extractOnly'
=>
'false'
,
'param1'
=>
'value1'
,
'param1'
=>
'value1'
,
'resource.name'
=>
'RequestBuilderTest.php'
,
'resource.name'
=>
'RequestBuilderTest.php'
,
'wt'
=>
'json'
,
'wt'
=>
'json'
,
...
...
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