Skip to content

Commit 3908ca2

Browse files
author
shodan
committed
updated php/python/java apis (added sph04 ranker)
git-svn-id: svn://svn.sphinxsearch.com/sphinx/trunk@1821 406a0c4d-033a-0410-8de8-e80135713968
1 parent d89ca6c commit 3908ca2

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

‎api/java/SphinxClient.java‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public class SphinxClient
3636
public final static int SPH_RANK_BM25 = 1;
3737
public final static int SPH_RANK_NONE = 2;
3838
public final static int SPH_RANK_WORDCOUNT = 3;
39+
public final static int SPH_RANK_PROXIMITY = 4;
40+
public final static int SPH_RANK_MATCHANY = 5;
41+
public final static int SPH_RANK_FIELDMASK = 6;
42+
public final static int SPH_RANK_SPH04 = 7;
43+
public final static int SPH_RANK_TOTAL = 8;
3944

4045
/* sorting modes */
4146
public final static int SPH_SORT_RELEVANCE = 0;
@@ -486,10 +491,7 @@ public void SetMatchMode(int mode) throws SphinxException
486491
/** Set ranking mode. */
487492
public void SetRankingMode ( int ranker ) throws SphinxException
488493
{
489-
myAssert ( ranker==SPH_RANK_PROXIMITY_BM25
490-
|| ranker==SPH_RANK_BM25
491-
|| ranker==SPH_RANK_NONE
492-
|| ranker==SPH_RANK_WORDCOUNT, "unknown ranker value; use one of the SPH_RANK_xxx constants" );
494+
myAssert ( ranker>=0 && ranker<SPH_RANK_TOTAL, "unknown ranker value; use one of the SPH_RANK_xxx constants" );
493495
_ranker = ranker;
494496
}
495497

‎api/sphinxapi.php‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
define ( "SPH_RANK_PROXIMITY", 4 );
5858
define ( "SPH_RANK_MATCHANY", 5 );
5959
define ( "SPH_RANK_FIELDMASK", 6 );
60+
define ( "SPH_RANK_SPH04", 7 );
61+
define ( "SPH_RANK_TOTAL", 8 );
6062

6163
/// known sort modes
6264
define ( "SPH_SORT_RELEVANCE", 0 );
@@ -702,13 +704,7 @@ function SetMatchMode ( $mode )
702704
/// set ranking mode
703705
function SetRankingMode ( $ranker )
704706
{
705-
assert ( $ranker==SPH_RANK_PROXIMITY_BM25
706-
|| $ranker==SPH_RANK_BM25
707-
|| $ranker==SPH_RANK_NONE
708-
|| $ranker==SPH_RANK_WORDCOUNT
709-
|| $ranker==SPH_RANK_PROXIMITY
710-
|| $ranker==SPH_RANK_MATCHANY
711-
|| $ranker==SPH_RANK_FIELDMASK );
707+
assert ( $ranker>=0 && $ranker<SPH_RANK_TOTAL );
712708
$this->_ranker = $ranker;
713709
}
714710

‎api/sphinxapi.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
SPH_RANK_PROXIMITY = 4
5757
SPH_RANK_MATCHANY = 5
5858
SPH_RANK_FIELDMASK = 6
59+
SPH_RANK_SPH04 = 7
60+
SPH_RANK_TOTAL = 8
5961

6062
# known sort modes
6163
SPH_SORT_RELEVANCE = 0
@@ -295,7 +297,7 @@ def SetRankingMode (self, ranker):
295297
"""
296298
Set ranking mode.
297299
"""
298-
assert(ranker in [SPH_RANK_PROXIMITY_BM25, SPH_RANK_BM25, SPH_RANK_NONE, SPH_RANK_WORDCOUNT, SPH_RANK_PROXIMITY, SPH_RANK_MATCHANY, SPH_RANK_FIELDMASK])
300+
assert(ranker>=0 and ranker<SPH_RANK_TOTAL)
299301
self._ranker = ranker
300302

301303

‎api/test.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
if ( $arg=="none" ) $ranker = SPH_RANK_NONE;
9191
if ( $arg=="wordcount" )$ranker = SPH_RANK_WORDCOUNT;
9292
if ( $arg=="fieldmask" )$ranker = SPH_RANK_FIELDMASK;
93+
if ( $arg=="sph04" ) $ranker = SPH_RANK_SPH04;
9394
}
9495
else
9596
$q .= $args[$i] . " ";

0 commit comments

Comments
 (0)