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
22213ac7
Commit
22213ac7
authored
Aug 18, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #39 from Gasol/mlt_support
Lots of style, comment and copyright modification
parents
b96e9212
20cbe625
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
56 additions
and
21 deletions
+56
-21
library/Solarium/Client.php
library/Solarium/Client.php
+5
-1
library/Solarium/Client/Adapter/PeclHttp.php
library/Solarium/Client/Adapter/PeclHttp.php
+10
-4
library/Solarium/Client/RequestBuilder/MoreLikeThis.php
library/Solarium/Client/RequestBuilder/MoreLikeThis.php
+6
-2
library/Solarium/Client/ResponseParser/MoreLikeThis.php
library/Solarium/Client/ResponseParser/MoreLikeThis.php
+8
-4
library/Solarium/Query/MoreLikeThis.php
library/Solarium/Query/MoreLikeThis.php
+12
-1
library/Solarium/Result/MoreLikeThis.php
library/Solarium/Result/MoreLikeThis.php
+9
-5
library/Solarium/Result/Select/MoreLikeThis.php
library/Solarium/Result/Select/MoreLikeThis.php
+3
-2
library/Solarium/Result/Select/MoreLikeThis/Result.php
library/Solarium/Result/Select/MoreLikeThis/Result.php
+3
-2
No files found.
library/Solarium/Client.php
View file @
22213ac7
...
@@ -71,6 +71,10 @@ class Solarium_Client extends Solarium_Configurable
...
@@ -71,6 +71,10 @@ class Solarium_Client extends Solarium_Configurable
* Querytype ping
* Querytype ping
*/
*/
const
QUERYTYPE_PING
=
'ping'
;
const
QUERYTYPE_PING
=
'ping'
;
/**
* Querytype morelikethis
*/
const
QUERYTYPE_MORELIKETHIS
=
'mlt'
;
const
QUERYTYPE_MORELIKETHIS
=
'mlt'
;
/**
/**
...
@@ -104,7 +108,7 @@ class Solarium_Client extends Solarium_Configurable
...
@@ -104,7 +108,7 @@ class Solarium_Client extends Solarium_Configurable
'responseparser'
=>
'Solarium_Client_ResponseParser_Ping'
'responseparser'
=>
'Solarium_Client_ResponseParser_Ping'
),
),
self
::
QUERYTYPE_MORELIKETHIS
=>
array
(
self
::
QUERYTYPE_MORELIKETHIS
=>
array
(
'query'
=>
'Solarium_Query_MoreLikeThis'
,
'query'
=>
'Solarium_Query_MoreLikeThis'
,
'requestbuilder'
=>
'Solarium_Client_RequestBuilder_MoreLikeThis'
,
'requestbuilder'
=>
'Solarium_Client_RequestBuilder_MoreLikeThis'
,
'responseparser'
=>
'Solarium_Client_ResponseParser_MoreLikeThis'
'responseparser'
=>
'Solarium_Client_ResponseParser_MoreLikeThis'
),
),
...
...
library/Solarium/Client/Adapter/PeclHttp.php
View file @
22213ac7
<?php
<?php
/**
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
* Copyright 2011 Gasol Wu. PIXNET Digital Media Corporation.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
@@ -28,9 +29,12 @@
...
@@ -28,9 +29,12 @@
* those of the authors and should not be interpreted as representing official
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
* policies, either expressed or implied, of the copyright holder.
*
*
* @copyright Copyright 2011
Bas de Nooijer <solarium@raspberry.nl
>
* @copyright Copyright 2011
Gasol Wu <gasol.wu@gmail.com
>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Client
*/
*/
/**
/**
...
@@ -71,7 +75,8 @@ class Solarium_Client_Adapter_PeclHttp extends Solarium_Client_Adapter
...
@@ -71,7 +75,8 @@ class Solarium_Client_Adapter_PeclHttp extends Solarium_Client_Adapter
if
(
!
isset
(
$options
[
'headers'
][
'Content-Type'
]))
{
if
(
!
isset
(
$options
[
'headers'
][
'Content-Type'
]))
{
$options
[
'headers'
][
'Content-Type'
]
=
'text/xml; charset=utf-8'
;
$options
[
'headers'
][
'Content-Type'
]
=
'text/xml; charset=utf-8'
;
}
}
$httpResponse
=
http_post_data
(
$uri
,
$request
->
getRawData
(),
$options
);
$httpResponse
=
http_post_data
(
$uri
,
$request
->
getRawData
(),
$options
);
}
else
if
(
$method
==
Solarium_Client_Request
::
METHOD_GET
)
{
}
else
if
(
$method
==
Solarium_Client_Request
::
METHOD_GET
)
{
$httpResponse
=
http_get
(
$uri
,
$options
);
$httpResponse
=
http_get
(
$uri
,
$options
);
}
else
if
(
$method
==
Solarium_Client_Request
::
METHOD_HEAD
)
{
}
else
if
(
$method
==
Solarium_Client_Request
::
METHOD_HEAD
)
{
...
@@ -85,7 +90,8 @@ class Solarium_Client_Adapter_PeclHttp extends Solarium_Client_Adapter
...
@@ -85,7 +90,8 @@ class Solarium_Client_Adapter_PeclHttp extends Solarium_Client_Adapter
if
(
$message
=
http_parse_message
(
$httpResponse
))
{
if
(
$message
=
http_parse_message
(
$httpResponse
))
{
$data
=
$message
->
body
;
$data
=
$message
->
body
;
if
(
$firstPositionOfCRLF
=
strpos
(
$httpResponse
,
"
\r\n\r\n
"
))
{
if
(
$firstPositionOfCRLF
=
strpos
(
$httpResponse
,
"
\r\n\r\n
"
))
{
$headersAsString
=
substr
(
$httpResponse
,
0
,
$firstPositionOfCRLF
);
$headersAsString
=
substr
(
$httpResponse
,
0
,
$firstPositionOfCRLF
);
$headers
=
explode
(
"
\n
"
,
$headersAsString
);
$headers
=
explode
(
"
\n
"
,
$headersAsString
);
}
}
}
}
...
...
library/Solarium/Client/RequestBuilder/MoreLikeThis.php
View file @
22213ac7
<?php
<?php
/**
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
* Copyright 2011 Bas de Nooijer.
* Copyright 2011 Gasol Wu. PIXNET Digital Media Corporation.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
@@ -29,6 +31,7 @@
...
@@ -29,6 +31,7 @@
* policies, either expressed or implied, of the copyright holder.
* policies, either expressed or implied, of the copyright holder.
*
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @copyright Copyright 2011 Gasol Wu <gasol.wu@gmail.com>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
* @link http://www.solarium-project.org/
*
*
...
@@ -42,7 +45,8 @@
...
@@ -42,7 +45,8 @@
* @package Solarium
* @package Solarium
* @subpackage Client
* @subpackage Client
*/
*/
class
Solarium_Client_RequestBuilder_MoreLikeThis
extends
Solarium_Client_RequestBuilder
class
Solarium_Client_RequestBuilder_MoreLikeThis
extends
Solarium_Client_RequestBuilder
{
{
/**
/**
...
...
library/Solarium/Client/ResponseParser/MoreLikeThis.php
View file @
22213ac7
<?php
<?php
/**
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
* Copyright 2011 Gasol Wu. PIXNET Digital Media Corporation.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
@@ -28,7 +29,7 @@
...
@@ -28,7 +29,7 @@
* those of the authors and should not be interpreted as representing official
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
* policies, either expressed or implied, of the copyright holder.
*
*
* @copyright Copyright 2011
Bas de Nooijer <solarium@raspberry.nl
>
* @copyright Copyright 2011
Gasol Wu <gasol.wu@gmail.com
>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
* @link http://www.solarium-project.org/
*
*
...
@@ -42,7 +43,8 @@
...
@@ -42,7 +43,8 @@
* @package Solarium
* @package Solarium
* @subpackage Client
* @subpackage Client
*/
*/
class
Solarium_Client_ResponseParser_MoreLikeThis
extends
Solarium_Client_ResponseParser_Select
class
Solarium_Client_ResponseParser_MoreLikeThis
extends
Solarium_Client_ResponseParser_Select
{
{
/**
/**
...
@@ -57,7 +59,9 @@ class Solarium_Client_ResponseParser_MoreLikeThis extends Solarium_Client_Respon
...
@@ -57,7 +59,9 @@ class Solarium_Client_ResponseParser_MoreLikeThis extends Solarium_Client_Respon
$query
=
$result
->
getQuery
();
$query
=
$result
->
getQuery
();
$postResult
=
parent
::
parse
(
$result
);
$postResult
=
parent
::
parse
(
$result
);
if
(
isset
(
$data
[
'interestingTerms'
])
and
'none'
!=
$query
->
getInterestingTerms
())
{
if
(
isset
(
$data
[
'interestingTerms'
])
and
'none'
!=
$query
->
getInterestingTerms
()
)
{
$terms
=
$data
[
'interestingTerms'
];
$terms
=
$data
[
'interestingTerms'
];
if
(
'details'
==
$query
->
getInterestingTerms
())
{
if
(
'details'
==
$query
->
getInterestingTerms
())
{
$tempTerms
=
array
();
$tempTerms
=
array
();
...
...
library/Solarium/Query/MoreLikeThis.php
View file @
22213ac7
<?php
<?php
/**
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
* Copyright 2011 Bas de Nooijer.
* Copyright 2011 Gasol Wu. PIXNET Digital Media Corporation.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
@@ -29,6 +31,7 @@
...
@@ -29,6 +31,7 @@
* policies, either expressed or implied, of the copyright holder.
* policies, either expressed or implied, of the copyright holder.
*
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @copyright Copyright 2011 Gasol Wu <gasol.wu@gmail.com>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
* @link http://www.solarium-project.org/
*
*
...
@@ -53,7 +56,15 @@ class Solarium_Query_MoreLikeThis extends Solarium_Query
...
@@ -53,7 +56,15 @@ class Solarium_Query_MoreLikeThis extends Solarium_Query
* Query components
* Query components
*/
*/
const
COMPONENT_DISMAX
=
'dismax'
;
const
COMPONENT_DISMAX
=
'dismax'
;
/**
* Query component morelikethis
*/
const
COMPONENT_MORELIKETHIS
=
'morelikethis'
;
const
COMPONENT_MORELIKETHIS
=
'morelikethis'
;
/**
* Query component highlighting
*/
const
COMPONENT_HIGHLIGHTING
=
'highlighting'
;
const
COMPONENT_HIGHLIGHTING
=
'highlighting'
;
/**
/**
...
...
library/Solarium/Result/MoreLikeThis.php
View file @
22213ac7
<?php
<?php
/**
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
* Copyright 2011 Gasol Wu. PIXNET Digital Media Corporation.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
@@ -28,7 +29,7 @@
...
@@ -28,7 +29,7 @@
* those of the authors and should not be interpreted as representing official
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
* policies, either expressed or implied, of the copyright holder.
*
*
* @copyright Copyright 2011
Bas de Nooijer <solarium@raspberry.nl
>
* @copyright Copyright 2011
Gasol Wu <gasol.wu@gmail.com
>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
* @link http://www.solarium-project.org/
*
*
...
@@ -39,7 +40,7 @@
...
@@ -39,7 +40,7 @@
/**
/**
* MoreLikeThis query result
* MoreLikeThis query result
*
*
* This is the standard resulttype for a
select
query. Example usage:
* This is the standard resulttype for a
moreLikeThis
query. Example usage:
* <code>
* <code>
* // total solr results
* // total solr results
* $result->getNumFound();
* $result->getNumFound();
...
@@ -58,6 +59,11 @@
...
@@ -58,6 +59,11 @@
*/
*/
class
Solarium_Result_MoreLikeThis
extends
Solarium_Result_Select
class
Solarium_Result_MoreLikeThis
extends
Solarium_Result_Select
{
{
/**
* interesting terms
*/
protected
$_interestingTerms
;
/**
/**
* this will show what "interesting" terms are used for the MoreLikeThis
* this will show what "interesting" terms are used for the MoreLikeThis
* query. These are the top tf/idf terms. NOTE: if you select 'details',
* query. These are the top tf/idf terms. NOTE: if you select 'details',
...
@@ -68,8 +74,6 @@ class Solarium_Result_MoreLikeThis extends Solarium_Result_Select
...
@@ -68,8 +74,6 @@ class Solarium_Result_MoreLikeThis extends Solarium_Result_Select
*
*
* @var array
* @var array
*/
*/
protected
$_interestingTerms
;
public
function
getInterestingTerms
()
public
function
getInterestingTerms
()
{
{
$query
=
$this
->
getQuery
();
$query
=
$this
->
getQuery
();
...
...
library/Solarium/Result/Select/MoreLikeThis.php
View file @
22213ac7
...
@@ -42,7 +42,8 @@
...
@@ -42,7 +42,8 @@
* @package Solarium
* @package Solarium
* @subpackage Result
* @subpackage Result
*/
*/
class
Solarium_Result_Select_MoreLikeThis
implements
IteratorAggregate
,
Countable
class
Solarium_Result_Select_MoreLikeThis
implements
IteratorAggregate
,
Countable
{
{
/**
/**
...
@@ -107,4 +108,4 @@ class Solarium_Result_Select_MoreLikeThis implements IteratorAggregate, Countabl
...
@@ -107,4 +108,4 @@ class Solarium_Result_Select_MoreLikeThis implements IteratorAggregate, Countabl
{
{
return
count
(
$this
->
_results
);
return
count
(
$this
->
_results
);
}
}
}
}
\ No newline at end of file
library/Solarium/Result/Select/MoreLikeThis/Result.php
View file @
22213ac7
...
@@ -42,7 +42,8 @@
...
@@ -42,7 +42,8 @@
* @package Solarium
* @package Solarium
* @subpackage Result
* @subpackage Result
*/
*/
class
Solarium_Result_Select_MoreLikeThis_Result
implements
IteratorAggregate
,
Countable
class
Solarium_Result_Select_MoreLikeThis_Result
implements
IteratorAggregate
,
Countable
{
{
/**
/**
...
@@ -136,4 +137,4 @@ class Solarium_Result_Select_MoreLikeThis_Result implements IteratorAggregate, C
...
@@ -136,4 +137,4 @@ class Solarium_Result_Select_MoreLikeThis_Result implements IteratorAggregate, C
{
{
return
count
(
$this
->
_documents
);
return
count
(
$this
->
_documents
);
}
}
}
}
\ No newline at end of file
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