Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

property (Structured Query)

isubiker edited this page Nov 11, 2011 · 1 revision

Properties can be queried by value (equals) or by containing the word or phrase (contains).

The following query matches documents where the state property is set to "published":

{
    "property": "state"
    "equals": "published"
}

<constraint>
    <property>state</property
    <equals>published</equals>
</constraint>

Outside of querying a property by strictly matching what it equals, they can also be queried for containing a word (or phrase):

{
    "property": "author"
    "contains": "Chomsky"
}

<constraint>
    <property>author</property
    <contains>Chomsky</contains>
</constraint>

Required:

  • property - The property name to query
  • One of the following, but not both:
    • equals - The value that the property will need to be equal to
    • contains - A string that the value of the property will need to contain

In the JSON format, if an array of values is given for either the equals or contains key, documents will match if any of the provided values are present. In the XML format, the equals or contains key can also contain any number of <value> elements, providing the same functionality (eg: <contains><value>Chomsky</value><value>Plato</value></contains>).

Optional configuration:

  • weight (number) - Configure how important or how heavily this term weighs in the query. The higher the number the more this term will contribute to the score of the document, thus appearing higher in the search results.
  • caseSensitive (boolean) - Setting to true ensures that case is matched, false ignores case. The default behavior examines the query and if it contains upper-case characters it performs a case sensitive search. The above example would default to being case sensitive.
  • diacriticSensitive (boolean) - Setting to true ensures that diacritics are matched, false ignore diacritics. The default behavior examines the query and if it contains diacritics it performs a diacritic sensitive search.
  • punctuationSensitve (boolean) - Setting to true ensures that punctuation is matched in the query. It's not recommended to issue punctuation sensitive searches as they can not be resolved out of the indexes and can easily yield poor performance.
  • whitespaceSensitive (boolean) - Setting to true ensures that whitespace is matched exactly as it is in the query, otherwise whitespace is normalized. It's not recommended to issue whitespace sensitive searches as they can not be resolved out of the indexes and can easily yield poor performance.
  • stemmed (boolean) - Setting to true stems search terms (eg: "flying" also matches "fly" and "flew").
  • wildcarded (boolean) - Setting to true treats "*" and "?" as wildcards in the query.

Example:

{
    "key": "author"
    "equals": "Noam Chomsky",
    "caseSensitive": true,
    "stemmed": false
}
Clone this wiki locally