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
21e37e64
Commit
21e37e64
authored
Aug 21, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added support for matched MLT doc
- small style / phpdoc fixes
parent
0ee858bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
7 deletions
+25
-7
library/Solarium/Result/MoreLikeThis.php
library/Solarium/Result/MoreLikeThis.php
+25
-7
No files found.
library/Solarium/Result/MoreLikeThis.php
View file @
21e37e64
...
...
@@ -42,13 +42,13 @@
*
* This is the standard resulttype for a moreLikeThis query. Example usage:
* <code>
* // total solr results
* // total solr
mlt
results
* $result->getNumFound();
*
* // results fetched
* count($result);
*
* // iterate over fetched docs
* // iterate over fetched
mlt
docs
* foreach ($result AS $doc) {
* ....
* }
...
...
@@ -60,27 +60,45 @@
class
Solarium_Result_MoreLikeThis
extends
Solarium_Result_Select
{
/**
* interesting terms
*
MLT
interesting terms
*/
protected
$_interestingTerms
;
/**
* Get MLT interesting terms
*
* this will show what "interesting" terms are used for the MoreLikeThis
* query. These are the top tf/idf terms. NOTE: if you select 'details',
* this shows you the term and boost used for each term. Unless
* mlt.boost=true all terms will have boost=1.0
*
* This is NOT the number of document fetched from Solr!
*
* @var array
* @return array
*/
public
function
getInterestingTerms
()
{
$query
=
$this
->
getQuery
();
if
(
'none'
==
$query
->
getInterestingTerms
())
{
throw
new
Solarium_Exception
(
'
mlt.interestingT
erms is none'
);
throw
new
Solarium_Exception
(
'
interestingt
erms is none'
);
}
$this
->
_parseResponse
();
return
$this
->
_interestingTerms
;
}
/**
* Get matched document
*
* Only available if matchinclude was set to true in the query.
*
* @throws Solarium_Exception
* @return Solarium_Document
*/
public
function
getMatch
()
{
$query
=
$this
->
getQuery
();
if
(
true
!=
$query
->
getMatchInclude
())
{
throw
new
Solarium_Exception
(
'matchinclude was disabled in the MLT query'
);
}
$this
->
_parseResponse
();
return
$this
->
_match
;
}
}
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