Browse Source

extended engine V2


git-svn-id: svn://svn.sphinxsearch.com/sphinx/trunk@891 406a0c4d-033a-0410-8de8-e80135713968
shodan 18 years ago
parent
commit
5e5d997f3c
5 changed files with 1533 additions and 99 deletions
  1. 4 1
      api/sphinxapi.php
  2. 5 0
      api/test.php
  3. 1 1
      src/searchd.cpp
  4. 1522 97
      src/sphinx.cpp
  5. 1 0
      src/sphinx.h

+ 4 - 1
api/sphinxapi.php

@@ -39,6 +39,8 @@ define ( "SPH_MATCH_ANY",			1 );
 define ( "SPH_MATCH_PHRASE",		2 );
 define ( "SPH_MATCH_BOOLEAN",		3 );
 define ( "SPH_MATCH_EXTENDED",		4 );
+define ( "SPH_MATCH_FULLSCAN",		5 );
+define ( "SPH_MATCH_EXTENDED2",		6 );	// extended engine V2 (TEMPORARY, WILL BE REMOVED IN 0.9.8-RELEASE)
 
 /// known sort modes
 define ( "SPH_SORT_RELEVANCE",		0 );
@@ -278,7 +280,8 @@ class SphinxClient
 			|| $mode==SPH_MATCH_ANY
 			|| $mode==SPH_MATCH_PHRASE
 			|| $mode==SPH_MATCH_BOOLEAN
-			|| $mode==SPH_MATCH_EXTENDED );
+			|| $mode==SPH_MATCH_EXTENDED
+			|| $mode==SPH_MATCH_EXTENDED2 );
 		$this->_mode = $mode;
 	}
 

+ 5 - 0
api/test.php

@@ -33,6 +33,7 @@ if ( !is_array($_SERVER["argv"]) || empty($_SERVER["argv"]) )
 	print ( "-g, --groupby <EXPR>\tgroup matches by 'EXPR'\n" );
 	print ( "-gs,--groupsort <EXPR>\tsort groups by 'EXPR'\n" );
 	print ( "-d, --distinct <ATTR>\tcount distinct values of 'ATTR''\n" );
+	print ( "-l, --limit <COUNT>\tretrieve COUNT matches (default: 20)\n" );
 	exit;
 }
 
@@ -51,6 +52,7 @@ $filter = "group_id";
 $filtervals = array();
 $distinct = "";
 $sortby = "";
+$limit = 20;
 for ( $i=0; $i<count($args); $i++ )
 {
 	$arg = $args[$i];
@@ -62,12 +64,14 @@ for ( $i=0; $i<count($args); $i++ )
 	else if ( $arg=="-a" || $arg=="--any" )			$mode = SPH_MATCH_ANY;
 	else if ( $arg=="-b" || $arg=="--boolean" )		$mode = SPH_MATCH_BOOLEAN;
 	else if ( $arg=="-e" || $arg=="--extended" )	$mode = SPH_MATCH_EXTENDED;
+	else if ( $arg=="-e2" )							$mode = SPH_MATCH_EXTENDED2;
 	else if ( $arg=="-ph"|| $arg=="--phrase" )		$mode = SPH_MATCH_PHRASE;
 	else if ( $arg=="-f" || $arg=="--filter" )		$filter = $args[++$i];
 	else if ( $arg=="-v" || $arg=="--value" )		$filtervals[] = (int)$args[++$i];
 	else if ( $arg=="-g" || $arg=="--groupby" )		$groupby = $args[++$i];
 	else if ( $arg=="-gs"|| $arg=="--groupsort" )	$groupsort = $args[++$i];
 	else if ( $arg=="-d" || $arg=="--distinct" )	$distinct = $args[++$i];
+	else if ( $arg=="-l" || $arg=="--limit" )		$limit = $args[++$i];
 	else
 		$q .= $args[$i] . " ";
 }
@@ -84,6 +88,7 @@ if ( count($filtervals) )	$cl->SetFilter ( $filter, $filtervals );
 if ( $groupby )				$cl->SetGroupBy ( $groupby, SPH_GROUPBY_ATTR, $groupsort );
 if ( $sortby )				$cl->SetSortMode ( SPH_SORT_EXTENDED, $sortby );
 if ( $distinct )			$cl->SetGroupDistinct ( $distinct );
+if ( $limit )				$cl->SetLimits ( 0, $limit, ( $limit>1000 ) ? $limit : 1000 );
 $res = $cl->Query ( $q, $index );
 
 ////////////////

+ 1 - 1
src/searchd.cpp

@@ -2432,7 +2432,7 @@ void LogQuery ( const CSphQuery & tQuery, const CSphQueryResult & tRes )
 	if ( tQuery.m_iGroupbyOffset>=0 )
 		snprintf ( sGroupBuf, sizeof(sGroupBuf), " @%s", tQuery.m_sGroupBy.cstr() );
 
-	static const char * sModes [ SPH_MATCH_TOTAL ] = { "all", "any", "phr", "bool", "ext", "scan" };
+	static const char * sModes [ SPH_MATCH_TOTAL ] = { "all", "any", "phr", "bool", "ext", "scan", "ext2" };
 	static const char * sSort [ SPH_SORT_TOTAL ] = { "rel", "attr-", "attr+", "tsegs", "ext" };
 
 	snprintf ( sBuf, sizeof(sBuf), "[%s] %d.%03d sec [%s/%d/%s %d (%d,%d)%s] [%s] %s\n",

File diff suppressed because it is too large
+ 1522 - 97
src/sphinx.cpp


+ 1 - 0
src/sphinx.h

@@ -1058,6 +1058,7 @@ enum ESphMatchMode
 	SPH_MATCH_BOOLEAN,			///< match this boolean query
 	SPH_MATCH_EXTENDED,			///< match this extended query
 	SPH_MATCH_FULLSCAN,			///< match all document IDs w/o fulltext query, apply filters
+	SPH_MATCH_EXTENDED2,		///< extended engine V2 (TEMPORARY, WILL BE REMOVED IN 0.9.8-RELEASE)
 
 	SPH_MATCH_TOTAL
 };

Some files were not shown because too many files changed in this diff