Apache Geode CHANGELOG

search lucene

search lucene

Search a Lucene index

See also create lucene index, describe lucene index, destroy lucene index and list lucene indexes.

Availability: Online.

Syntax:

search lucene --name=value --region=value --queryString=value --defaultField=value
    [--limit=value] [--keys-only=value]

Parameters, search lucene:

Name Description Default Value
‑‑name Required. Name of the Lucene index to search.
‑‑region Required. Name/Path of the region where the Lucene index exists.
‑‐queryString Required. Query string to search the Lucene index. Use __REGION_VALUE_FIELD as the field name within the query string when the field is a primitive value. Surround a string with double quote marks to do an exact match of the string.
‑‐defaultField Required. Default field to search in. __REGION_VALUE_FIELD identifies the field as a primitive value.
‑‑limit Number of search results needed. If the parameter is not specified: -1
‑‑keys-only Return only keys of search results. If the parameter is not specified: false

Example Commands:

gfsh> search lucene --name=testIndex --region=/testRegion --queryString=value1
   --defaultField=__REGION_VALUE_FIELD


gfsh> search lucene --name=indexOfStrings --region=/stringTestRegion 
      --queryString='__REGION_VALUE_FIELD:"my exact string"'
      --defaultField=__REGION_VALUE_FIELD

Sample Output:

gfsh>search lucene --name=testIndex --region=/testRegion --queryString=value* 
   --defaultField=__REGION_VALUE_FIELD
key | value  | score
--- | ------ | -----
3   | value3 | 1
2   | value2 | 1
1   | value1 | 1
gfsh>search lucene --region=/Person --name=analyzerIndex 
   --defaultField=addr --queryString="97763"
 key   |                         value                                      | score
------ | ------------------------------------------------------------------ | --------
key763 | Person{name='Kris Cat', addr='7 Ash St, Portland_OR_97763', emai.. | 1.669657