PHP 5.6.0 released

The SolrQuery class

Introduction

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

Class synopsis

SolrQuery extends SolrModifiableParams implements Serializable {
/* Constants */
const integer SolrQuery::ORDER_ASC = 0 ;
const integer SolrQuery::ORDER_DESC = 1 ;
const integer SolrQuery::FACET_SORT_INDEX = 0 ;
const integer SolrQuery::FACET_SORT_COUNT = 1 ;
const integer SolrQuery::TERMS_SORT_INDEX = 0 ;
const integer SolrQuery::TERMS_SORT_COUNT = 1 ;
/* Properties */
/* Methods */
public SolrQuery addFacetDateField ( string $dateField )
publicSolrQuery addFacetDateOther ( string $value [, string $field_override ] )
publicSolrQuery addFacetField ( string $field )
publicSolrQuery addFacetQuery ( string $facetQuery )
publicSolrQuery addField ( string $field )
publicSolrQuery addFilterQuery ( string $fq )
publicSolrQuery addHighlightField ( string $field )
publicSolrQuery addMltField ( string $field )
publicSolrQuery addMltQueryField ( string $field , float $boost )
publicSolrQuery addSortField ( string $field [, int $order = SolrQuery::ORDER_DESC ] )
publicSolrQuery addStatsFacet ( string $field )
public SolrQuery addStatsField ( string $field )
__construct ([ string $q ] )
publicvoid __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 )
publicSolrQuery removeFacetDateField ( string $field )
publicSolrQuery removeFacetDateOther ( string $value [, string $field_override ] )
publicSolrQuery removeFacetField ( string $field )
publicSolrQuery removeFacetQuery ( string $value )
publicSolrQuery removeField ( string $field )
publicSolrQuery removeFilterQuery ( string $fq )
publicSolrQuery removeHighlightField ( string $field )
publicSolrQuery removeMltField ( string $field )
publicSolrQuery removeMltQueryField ( string $queryField )
publicSolrQuery removeSortField ( string $field )
publicSolrQuery removeStatsFacet ( string $value )
publicSolrQuery removeStatsField ( string $field )
publicSolrQuery setEchoHandler ( bool $flag )
publicSolrQuery setEchoParams ( string $type )
publicSolrQuery setExplainOther ( string $query )
publicSolrQuery setFacet ( bool $flag )
publicSolrQuery setFacetDateEnd ( string $value [, string $field_override ] )
publicSolrQuery setFacetDateGap ( string $value [, string $field_override ] )
publicSolrQuery setFacetDateHardEnd ( bool $value [, string $field_override ] )
publicSolrQuery setFacetDateStart ( string $value [, string $field_override ] )
publicSolrQuery setFacetEnumCacheMinDefaultFrequency ( int $frequency [, string $field_override ] )
publicSolrQuery setFacetLimit ( int $limit [, string $field_override ] )
publicSolrQuery setFacetMethod ( string $method [, string $field_override ] )
publicSolrQuery setFacetMinCount ( int $mincount [, string $field_override ] )
publicSolrQuery setFacetMissing ( bool $flag [, string $field_override ] )
publicSolrQuery setFacetOffset ( int $offset [, string $field_override ] )
publicSolrQuery setFacetPrefix ( string $prefix [, string $field_override ] )
publicSolrQuery setFacetSort ( int $facetSort [, string $field_override ] )
publicSolrQuery setHighlight ( bool $flag )
publicSolrQuery setHighlightAlternateField ( string $field [, string $field_override ] )
publicSolrQuery setHighlightFormatter ( string $formatter [, string $field_override ] )
publicSolrQuery setHighlightFragmenter ( string $fragmenter [, string $field_override ] )
publicSolrQuery setHighlightFragsize ( int $size [, string $field_override ] )
publicSolrQuery setHighlightHighlightMultiTerm ( bool $flag )
publicSolrQuery setHighlightMaxAlternateFieldLength ( int $fieldLength [, string $field_override ] )
publicSolrQuery setHighlightMaxAnalyzedChars ( int $value )
publicSolrQuery setHighlightMergeContiguous ( bool $flag [, string $field_override ] )
publicSolrQuery setHighlightRegexMaxAnalyzedChars ( int $maxAnalyzedChars )
publicSolrQuery setHighlightRegexPattern ( string $value )
publicSolrQuery setHighlightRegexSlop ( float $factor )
publicSolrQuery setHighlightRequireFieldMatch ( bool $flag )
publicSolrQuery setHighlightSimplePost ( string $simplePost [, string $field_override ] )
publicSolrQuery setHighlightSimplePre ( string $simplePre [, string $field_override ] )
publicSolrQuery setHighlightSnippets ( int $value [, string $field_override ] )
publicSolrQuery setHighlightUsePhraseHighlighter ( bool $flag )
publicSolrQuery setMlt ( bool $flag )
publicSolrQuery setMltBoost ( bool $flag )
publicSolrQuery setMltCount ( int $count )
publicSolrQuery setMltMaxNumQueryTerms ( int $value )
publicSolrQuery setMltMaxNumTokens ( int $value )
publicSolrQuery setMltMaxWordLength ( int $maxWordLength )
publicSolrQuery setMltMinDocFrequency ( int $minDocFrequency )
publicSolrQuery setMltMinTermFrequency ( int $minTermFrequency )
publicSolrQuery setMltMinWordLength ( int $minWordLength )
publicSolrQuery setOmitHeader ( bool $flag )
publicSolrQuery setQuery ( string $query )
publicSolrQuery setRows ( int $rows )
publicSolrQuery setShowDebugInfo ( bool $flag )
publicSolrQuery setStart ( int $start )
publicSolrQuery setStats ( bool $flag )
publicSolrQuery setTerms ( bool $flag )
publicSolrQuery setTermsField ( string $fieldname )
publicSolrQuery setTermsIncludeLowerBound ( bool $flag )
publicSolrQuery setTermsIncludeUpperBound ( bool $flag )
publicSolrQuery setTermsLimit ( int $limit )
publicSolrQuery setTermsLowerBound ( string $lowerBound )
publicSolrQuery setTermsMaxCount ( int $frequency )
publicSolrQuery setTermsMinCount ( int $frequency )
publicSolrQuery setTermsPrefix ( string $prefix )
publicSolrQuery setTermsReturnRaw ( bool $flag )
publicSolrQuery setTermsSort ( int $sortType )
publicSolrQuery setTermsUpperBound ( string $upperBound )
publicSolrQuery setTimeAllowed ( int $timeAllowed )
/* Inherited methods */
public void SolrModifiableParams::__destruct ( void )
}

Predefined Constants

SolrQuery Node Types

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

add a note add a note

User Contributed Notes 1 note

up
0
andy at borkedcoder dot com
2 years ago
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.
To Top