Message-ID: <1144605854.2856.1485851024604.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_2855_452564849.1485851024604" ------=_Part_2855_452564849.1485851024604 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Search Criteria Reference

Search Criteria Reference

=20
=20
=20
=20

Criteria are the filters for Content and Loca= tion Search, for generic use of API Search see  Search Criteria and Sort Clauses .

A Criterion consist of two parts just like SortClause and FacetBuilder:

  • The API Value: Criterion
  • Specific handler per search engine: Criterion Handler

Criterion represents the value you use in the API, whi= le CriterionHandler deals with the business logic in= the background translating the value to something the Search engine can un= derstand.

Implementation and availability of a handler typically depends on s= earch engine capabilities and limitations, currently only Legacy (SQL)= Search Engine exists, and for instance its support for FullText and Field = Criterion is not optimal and it is advised to avoid heavy use of these unti= l future search engine arrives.

Common con= cepts for most Criteria

For how to use each and every Criterion see the list below, as it depend= s on the Criterion Value constructor, but in general you shou= ld be aware of the following common concepts:

  • target: Exposed if the given Criterion supports targeting = a specific sub field, example: FieldDefinition or Meta Data identifier
  • value: The value(s) to filter on, this = is typically a  scalar or array of scalars.
  • operator: Exposed on some Criteria
    • All operators can be seen as constants on eZ\Publish\API\Reposito= ry\Values\Content\Query\Criterion\Operator, at time of writing: IN, EQ, GT, GTE, LT, LTE, LIKE, BETWEEN, CONTAINS
    • Most Criteria do not expose this and select EQ or<= /strong> IN depending on if value is scalar or array
    • INBETWEEN always acts on an array of values, while the other operators act on single scal= ar value
  • valueData : Additional value data, required by some Criteria, MapLocationDistance = for instance

 

In the Legacy search engine, the field index/sort key column is limited = to 255 characters by design.
Due to this storage limitation, searching c= ontent using the eZ Country Field Type or Keyword when there are multiple v= alues selected may not return all the expected results.


=

List of Criteria

The list below reflects Criteria available in the eZ\Publish\API\R= epository\Values\Content\Query\Criterion namespace (it is also possi= ble to make a custom Criterion):

Only for LocationS= earch

Criterion Constructor arguments description
Location\Depth operator (IN, E= Q, GT, GTE, LT, LTE, BETWEEN), value being the Location= depth(s) as an integer(s).
Location\IsMainLocation Whether or not the Location is a M= ain Location
value (Location\IsMainLocation::MAIN, Location\IsMainLocation::NOT_MAIN).
Location\Priority Priorities are integers that can b= e used for sorting in ascending or descending order. What is higher or lowe= r priority in relation to the priority number is left to the user choice. operator (GT, GTE, LT, LTE, BETWEEN), va= lue being the location priority(s) as an integer(s).

 

Common

Criterion Constructor arguments description
ContentId value being sc= alar(s) representing the Content id.
ContentTypeGroupId value being sc= alar(s) representing the Content Typ eGroup id.
ContentTypeId value being sc= alar(s) representing the Content Type id.
ContentTypeIdentifier=   value being st= ring(s) representing the Content Type identifier, example: "article".
DateMetadata target ( DateMetadata ::MODIFIED , DateMet= adata ::CREATED), operator (IN, EQ,= GT, GTE, LT, LTE, BETWEEN), value being integer(s) representing uni= x timestamp.
Field

target (FieldDefinition identifier ), operator = ( IN, EQ, GT, GTE, LT, LTE, LIKE,=   BETWEEN, CONTAINS), = value being scalar(s) rele= vant for the field.

FieldRelation target (= FieldDefinition identifier ), operator ( IN , CONTAINS= ),  value being= array of scalars representing Content id of relation.
Use o= f IN means relation needs to have one of the provided ID's, wh= ile CONTAINS implies it needs to have all provided id's. =
FullText

value being the st= ring to search for, properties is array to set additional prop= erties for use with future search engines like Solr/ElasticSearch.

LanguageCode value being string(s)= representing Language Code(s) on the Content (not on Fields), matchAlwaysAvailable as boolean.
LocationId value being sc= alar(s) representing the Location id.
LocationRemoteId value being st= ring(s) representing the Location Remote id.
LogicalAnd A LogicalOperator that takes array of other Criteria, makes sure all Criteri= a match.
LogicalNot A Logic= alOperator that takes array of other Criteria, makes su= re none of the Criteria match.
LogicalOr A Logic= alOperator that takes array of other Criteria, makes su= re one of the Criteria match.
MapLocationDistance target (= FieldDefinition identifier ), operator ( IN, EQ, GT, GTE, LT, LTE, = BETWEEN), distance <= span> as float(s) from a position using latitude as float , longitu= de as float as arguments
MatchAll No arguments, mainly for inter= nal use when no filter or query is provided on Query object.
MatchNone No arguments, mainly= for internal use by Bloc= kingLimitation.
ObjectStateId value being st= ring(s) representing the Content ObjectState id.
ParentLocationId

value being scalar(s) rep= resenting the Parent's Location id

RemoteId value being st= ring(s) representing the Content Remote id.
SectionId value being sc= alar(s) representing the Content Section id.
Subtree value being st= ring(s) representing the Location id in which you can filter. If the Lo= cation Id is  /1/2/20/42, you will filter everything under 42.
UserMetadata target (UserMet= adata ::OWNER , User= Metadata ::GROUP , UserMetadata ::MODIFIER), operator (IN, EQ<= /code> ), value bei= ng scalars (s) representing the User or User Gro= up id(s).
Visibility value (Visibili= ty ::VISIBLE , Visib= ility ::HIDDEN), Note: This acts o= n all assigned locations when used with ContentSearch, meaning hidden conte= nt will be returned if it has a location which is visible. Use LocationSear= ch to avoid this.
=20
=20
=20
=20

In this topic:

=20
=20
=20
------=_Part_2855_452564849.1485851024604--