PHP 8.4.0 RC4 available for testing

La clase SolrQuery

(PECL solr >= 0.9.2)

Introducción

Representa una colección de pares nombre-valor enviados al servidor Solr durante una petición.

Sinopsis de la Clase

class SolrQuery extends SolrModifiableParams implements Serializable {
/* Constantes */
const int ORDER_ASC = 0;
const int ORDER_DESC = 1;
/* Propiedades */
/* Métodos */
public __construct(string $q = ?)
public addExpandSortField(string $field, string $order = ?): SolrQuery
public addFacetDateField(string $dateField): SolrQuery
public addFacetDateOther(string $value, string $field_override = ?): SolrQuery
public addFacetQuery(string $facetQuery): SolrQuery
public addField(string $field): SolrQuery
public addGroupSortField(string $field, int $order = ?): SolrQuery
public addMltField(string $field): SolrQuery
public addMltQueryField(string $field, float $boost): SolrQuery
public addSortField(string $field, int $order = SolrQuery::ORDER_DESC): SolrQuery
public collapse(SolrCollapseFunction $collapseFunction): SolrQuery
public getExpand(): bool
public getExpandRows(): int
public getFacet(): bool
public getFacetDateEnd(string $field_override = ?): string
public getFacetDateGap(string $field_override = ?): string
public getFacetDateHardEnd(string $field_override = ?): string
public getFacetDateOther(string $field_override = ?): array
public getFacetDateStart(string $field_override = ?): string
public getFacetLimit(string $field_override = ?): int
public getFacetMethod(string $field_override = ?): string
public getFacetMinCount(string $field_override = ?): int
public getFacetMissing(string $field_override = ?): bool
public getFacetOffset(string $field_override = ?): int
public getFacetPrefix(string $field_override = ?): string
public getFacetSort(string $field_override = ?): int
public getFields(): array
public getGroup(): bool
public getGroupLimit(): int
public getGroupMain(): bool
public getHighlight(): bool
public getHighlightAlternateField(string $field_override = ?): string
public getHighlightFormatter(string $field_override = ?): string
public getHighlightFragmenter(string $field_override = ?): string
public getHighlightFragsize(string $field_override = ?): int
public getHighlightMaxAlternateFieldLength(string $field_override = ?): int
public getHighlightMergeContiguous(string $field_override = ?): bool
public getHighlightSimplePost(string $field_override = ?): string
public getHighlightSimplePre(string $field_override = ?): string
public getHighlightSnippets(string $field_override = ?): int
public getMlt(): bool
public getMltBoost(): bool
public getMltCount(): int
public getQuery(): string
public getRows(): int
public getStart(): int
public getStats(): bool
public getTerms(): bool
public getTermsLimit(): int
public getTermsSort(): int
public removeFacetDateOther(string $value, string $field_override = ?): SolrQuery
public removeField(string $field): SolrQuery
public removeMltQueryField(string $queryField): SolrQuery
public setExpand(bool $value): SolrQuery
public setExpandRows(int $value): SolrQuery
public setFacet(bool $flag): SolrQuery
public setFacetDateEnd(string $value, string $field_override = ?): SolrQuery
public setFacetDateGap(string $value, string $field_override = ?): SolrQuery
public setFacetDateHardEnd(bool $value, string $field_override = ?): SolrQuery
public setFacetDateStart(string $value, string $field_override = ?): SolrQuery
public setFacetEnumCacheMinDefaultFrequency(int $frequency, string $field_override = ?): SolrQuery
public setFacetLimit(int $limit, string $field_override = ?): SolrQuery
public setFacetMethod(string $method, string $field_override = ?): SolrQuery
public setFacetMinCount(int $mincount, string $field_override = ?): SolrQuery
public setFacetMissing(bool $flag, string $field_override = ?): SolrQuery
public setFacetOffset(int $offset, string $field_override = ?): SolrQuery
public setFacetPrefix(string $prefix, string $field_override = ?): SolrQuery
public setFacetSort(int $facetSort, string $field_override = ?): SolrQuery
public setGroup(bool $value): SolrQuery
public setGroupFacet(bool $value): SolrQuery
public setGroupLimit(int $value): SolrQuery
public setGroupMain(string $value): SolrQuery
public setGroupOffset(int $value): SolrQuery
public setHighlight(bool $flag): SolrQuery
public setHighlightAlternateField(string $field, string $field_override = ?): SolrQuery
public setHighlightFormatter(string $formatter, string $field_override = ?): SolrQuery
public setHighlightFragmenter(string $fragmenter, string $field_override = ?): SolrQuery
public setHighlightFragsize(int $size, string $field_override = ?): SolrQuery
public setHighlightMaxAlternateFieldLength(int $fieldLength, string $field_override = ?): SolrQuery
public setHighlightMergeContiguous(bool $flag, string $field_override = ?): SolrQuery
public setHighlightSimplePost(string $simplePost, string $field_override = ?): SolrQuery
public setHighlightSimplePre(string $simplePre, string $field_override = ?): SolrQuery
public setHighlightSnippets(int $value, string $field_override = ?): SolrQuery
public setMlt(bool $flag): SolrQuery
public setMltBoost(bool $flag): SolrQuery
public setMltCount(int $count): SolrQuery
public setMltMaxWordLength(int $maxWordLength): SolrQuery
public setMltMinDocFrequency(int $minDocFrequency): SolrQuery
public setMltMinTermFrequency(int $minTermFrequency): SolrQuery
public setMltMinWordLength(int $minWordLength): SolrQuery
public setQuery(string $query): SolrQuery
public setRows(int $rows): SolrQuery
public setStart(int $start): SolrQuery
public setStats(bool $flag): SolrQuery
public setTerms(bool $flag): SolrQuery
public setTermsField(string $fieldname): SolrQuery
public setTermsLimit(int $limit): SolrQuery
public setTermsLowerBound(string $lowerBound): SolrQuery
public setTermsMaxCount(int $frequency): SolrQuery
public setTermsMinCount(int $frequency): SolrQuery
public setTermsSort(int $sortType): SolrQuery
public setTermsUpperBound(string $upperBound): SolrQuery
public setTimeAllowed(int $timeAllowed): SolrQuery
public __destruct()
/* Métodos heredados */
}

Constantes predefinidas

SolrQuery::ORDER_ASC

Se usa para especificar la forma de ordenación debería se ascendente

SolrQuery::ORDER_DESC

Se usa para especificar la forma de ordenación debería se descendente

SolrQuery::FACET_SORT_INDEX

Se usa para especificar que la faceta debería ordenarse según el índice

SolrQuery::FACET_SORT_COUNT

Se usa para especificar que la faceta debería ordenarse según la cuenta

SolrQuery::TERMS_SORT_INDEX

Usado en TermsComponent

SolrQuery::TERMS_SORT_COUNT

Usado en TermsComponent

Tabla de contenidos

add a note

User Contributed Notes 1 note

up
4
andy at borkedcoder dot com
12 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