Solr
在线手册:中文 英文
PHP手册

The SolrQuery class

(No version information available, might only be in SVN)

简介

Represents a collection of name-value pairs sent to the Solr server during a request.

类摘要

SolrQuery extends SolrModifiableParams implements Serializable {
/* 常量 */
const integer ORDER_ASC = 0 ;
const integer ORDER_DESC = 1 ;
const integer FACET_SORT_INDEX = 0 ;
const integer FACET_SORT_COUNT = 1 ;
const integer TERMS_SORT_INDEX = 0 ;
const integer TERMS_SORT_COUNT = 1 ;
/* 属性 */
/* 方法 */
public SolrQuery addFacetDateField ( string $dateField )
public SolrQuery addFacetDateOther ( string $value [, string $field_override ] )
public SolrQuery addFacetField ( string $field )
public SolrQuery addFacetQuery ( string $facetQuery )
public SolrQuery addField ( string $field )
public SolrQuery addFilterQuery ( string $fq )
public SolrQuery addHighlightField ( string $field )
public SolrQuery addMltField ( string $field )
public SolrQuery addMltQueryField ( string $field , float $boost )
public SolrQuery addSortField ( string $field [, int $order = SolrQuery::ORDER_DESC ] )
public SolrQuery addStatsFacet ( string $field )
public SolrQuery addStatsField ( string $field )
public __construct ([ string $q ] )
public void __destruct ( void )
public bool getFacet ( void )
public string getFacetDateEnd ([ string $field_override ] )
public array getFacetDateFields ( void )
public string getFacetDateGap ([ string $field_override ] )
public string getFacetDateHardEnd ([ string $field_override ] )
public array getFacetDateOther ([ string $field_override ] )
public string getFacetDateStart ([ string $field_override ] )
public array getFacetFields ( void )
public int getFacetLimit ([ string $field_override ] )
public string getFacetMethod ([ string $field_override ] )
public int getFacetMinCount ([ string $field_override ] )
public bool getFacetMissing ([ string $field_override ] )
public int getFacetOffset ([ string $field_override ] )
public string getFacetPrefix ([ string $field_override ] )
public array getFacetQueries ( void )
public int getFacetSort ([ string $field_override ] )
public array getFields ( void )
public array getFilterQueries ( void )
public bool getHighlight ( void )
public string getHighlightAlternateField ([ string $field_override ] )
public array getHighlightFields ( void )
public string getHighlightFormatter ([ string $field_override ] )
public string getHighlightFragmenter ([ string $field_override ] )
public int getHighlightFragsize ([ string $field_override ] )
public bool getHighlightHighlightMultiTerm ( void )
public int getHighlightMaxAlternateFieldLength ([ string $field_override ] )
public int getHighlightMaxAnalyzedChars ( void )
public bool getHighlightMergeContiguous ([ string $field_override ] )
public string getHighlightRegexPattern ( void )
public float getHighlightRegexSlop ( void )
public bool getHighlightRequireFieldMatch ( void )
public string getHighlightSimplePost ([ string $field_override ] )
public string getHighlightSimplePre ([ string $field_override ] )
public int getHighlightSnippets ([ string $field_override ] )
public bool getHighlightUsePhraseHighlighter ( void )
public bool getMlt ( void )
public bool getMltBoost ( void )
public int getMltCount ( void )
public array getMltFields ( void )
public int getMltMaxNumQueryTerms ( void )
public int getMltMaxNumTokens ( void )
public int getMltMaxWordLength ( void )
public int getMltMinDocFrequency ( void )
public int getMltMinTermFrequency ( void )
public int getMltMinWordLength ( void )
public array getMltQueryFields ( void )
public string getQuery ( void )
public int getRows ( void )
public array getSortFields ( void )
public int getStart ( void )
public bool getStats ( void )
public array getStatsFacets ( void )
public array getStatsFields ( void )
public bool getTerms ( void )
public string getTermsField ( void )
public bool getTermsIncludeLowerBound ( void )
public bool getTermsIncludeUpperBound ( void )
public int getTermsLimit ( void )
public string getTermsLowerBound ( void )
public int getTermsMaxCount ( void )
public int getTermsMinCount ( void )
public string getTermsPrefix ( void )
public bool getTermsReturnRaw ( void )
public int getTermsSort ( void )
public string getTermsUpperBound ( void )
public int getTimeAllowed ( void )
public SolrQuery removeFacetDateField ( string $field )
public SolrQuery removeFacetDateOther ( string $value [, string $field_override ] )
public SolrQuery removeFacetField ( string $field )
public SolrQuery removeFacetQuery ( string $value )
public SolrQuery removeField ( string $field )
public SolrQuery removeFilterQuery ( string $fq )
public SolrQuery removeHighlightField ( string $field )
public SolrQuery removeMltField ( string $field )
public SolrQuery removeMltQueryField ( string $queryField )
public SolrQuery removeSortField ( string $field )
public SolrQuery removeStatsFacet ( string $value )
public SolrQuery removeStatsField ( string $field )
public SolrQuery setEchoHandler ( bool $flag )
public SolrQuery setEchoParams ( string $type )
public SolrQuery setExplainOther ( string $query )
public SolrQuery setFacet ( bool $flag )
public SolrQuery setFacetDateEnd ( string $value [, string $field_override ] )
public SolrQuery setFacetDateGap ( string $value [, string $field_override ] )
public SolrQuery setFacetDateHardEnd ( bool $value [, string $field_override ] )
public SolrQuery setFacetDateStart ( string $value [, string $field_override ] )
public SolrQuery setFacetEnumCacheMinDefaultFrequency ( int $frequency [, string $field_override ] )
public SolrQuery setFacetLimit ( int $limit [, string $field_override ] )
public SolrQuery setFacetMethod ( string $method [, string $field_override ] )
public SolrQuery setFacetMinCount ( int $mincount [, string $field_override ] )
public SolrQuery setFacetMissing ( bool $flag [, string $field_override ] )
public SolrQuery setFacetOffset ( int $offset [, string $field_override ] )
public SolrQuery setFacetPrefix ( string $prefix [, string $field_override ] )
public SolrQuery setFacetSort ( int $facetSort [, string $field_override ] )
public SolrQuery setHighlight ( bool $flag )
public SolrQuery setHighlightAlternateField ( string $field [, string $field_override ] )
public SolrQuery setHighlightFormatter ( string $formatter [, string $field_override ] )
public SolrQuery setHighlightFragmenter ( string $fragmenter [, string $field_override ] )
public SolrQuery setHighlightFragsize ( int $size [, string $field_override ] )
public SolrQuery setHighlightHighlightMultiTerm ( bool $flag )
public SolrQuery setHighlightMaxAlternateFieldLength ( int $fieldLength [, string $field_override ] )
public SolrQuery setHighlightMaxAnalyzedChars ( int $value )
public SolrQuery setHighlightMergeContiguous ( bool $flag [, string $field_override ] )
public SolrQuery setHighlightRegexMaxAnalyzedChars ( int $maxAnalyzedChars )
public SolrQuery setHighlightRegexPattern ( string $value )
public SolrQuery setHighlightRegexSlop ( float $factor )
public SolrQuery setHighlightRequireFieldMatch ( bool $flag )
public SolrQuery setHighlightSimplePost ( string $simplePost [, string $field_override ] )
public SolrQuery setHighlightSimplePre ( string $simplePre [, string $field_override ] )
public SolrQuery setHighlightSnippets ( int $value [, string $field_override ] )
public SolrQuery setHighlightUsePhraseHighlighter ( bool $flag )
public SolrQuery setMlt ( bool $flag )
public SolrQuery setMltBoost ( bool $flag )
public SolrQuery setMltCount ( int $count )
public SolrQuery setMltMaxNumQueryTerms ( int $value )
public SolrQuery setMltMaxNumTokens ( int $value )
public SolrQuery setMltMaxWordLength ( int $maxWordLength )
public SolrQuery setMltMinDocFrequency ( int $minDocFrequency )
public SolrQuery setMltMinTermFrequency ( int $minTermFrequency )
public SolrQuery setMltMinWordLength ( int $minWordLength )
public SolrQuery setOmitHeader ( bool $flag )
public SolrQuery setQuery ( string $query )
public SolrQuery setRows ( int $rows )
public SolrQuery setShowDebugInfo ( bool $flag )
public SolrQuery setStart ( int $start )
public SolrQuery setStats ( bool $flag )
public SolrQuery setTerms ( bool $flag )
public SolrQuery setTermsField ( string $fieldname )
public SolrQuery setTermsIncludeLowerBound ( bool $flag )
public SolrQuery setTermsIncludeUpperBound ( bool $flag )
public SolrQuery setTermsLimit ( int $limit )
public SolrQuery setTermsLowerBound ( string $lowerBound )
public SolrQuery setTermsMaxCount ( int $frequency )
public SolrQuery setTermsMinCount ( int $frequency )
public SolrQuery setTermsPrefix ( string $prefix )
public SolrQuery setTermsReturnRaw ( bool $flag )
public SolrQuery setTermsSort ( int $sortType )
public SolrQuery setTermsUpperBound ( string $upperBound )
public SolrQuery setTimeAllowed ( int $timeAllowed )
/* 继承的方法 */
public void SolrModifiableParams::__destruct ( void )
}

预定义常量

SolrQuery::ORDER_ASC

Used to specify that the sorting should be in acending order

SolrQuery::ORDER_DESC

Used to specify that the sorting should be in descending order

SolrQuery::FACET_SORT_INDEX

Used to specify that the facet should sort by index

SolrQuery::FACET_SORT_COUNT

Used to specify that the facet should sort by count

SolrQuery::TERMS_SORT_INDEX

Used in the TermsComponent

SolrQuery::TERMS_SORT_COUNT

Used in the TermsComponent

Table of Contents


Solr
在线手册:中文 英文
PHP手册
PHP手册 - N: The SolrQuery class

用户评论:

andy at borkedcoder dot com (30-Jan-2012 07:36)

Note - if using morelikethis, and your query is on a numeric ID, then you will not be able to access the moreLikeThis object in the results...

when q=id:3493 searching with mlt, result is:

SolrObject Object
(
...
    [moreLikeThis] => SolrObject Object
        (
            [3493] => SolrObject Object
                (
                    [numFound] => 6286
                    [start] => 0
                    [docs] => Array
                        (
....etc

the numeric object name (3493 above) is impossible to access

not by $response->moreLikeThis->{3493} nor $response->moreLikeThis->{'3493'}, nothing...

only way is to convert the moreLikeThis object into an array with:
$response_array = (array) $response->moreLikeThis;

then iterate the array as the array key is known.