forked from apache/geode-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apache#34 from apache/feature/GEODE-3789
Feature/geode 3789
- Loading branch information
Showing
5 changed files
with
99 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,15 +51,15 @@ will also be retrieved from the region and printed to the console. | |
|
||
$ gfsh | ||
... | ||
gfsh>connect --locators=127.0.0.1[10334] | ||
gfsh>connect --locators=localhost[10334] | ||
gfsh>query --query="select * from /example-region" | ||
... | ||
|
||
2. Try different Lucene searches for data in example-region | ||
|
||
gfsh> list lucene indexes | ||
|
||
Note that each server that holds partitioned data for this region has both the ```simpleIndex``` and the ```analyzerIndex```. Each Lucene index is stored as a co-located region with the partitioned data region. | ||
Note that each server that holds partitioned data for this region has both the ```simpleIndex``` , ```analyzerIndex``` and the ```nestedObjectIndex```. Each Lucene index is stored as a co-located region with the partitioned data region. | ||
|
||
// Search for an exact name match | ||
gfsh>search lucene --name=simpleIndex --region=example-region --queryStrings="Jive" --defaultField=lastName | ||
|
@@ -73,6 +73,16 @@ will also be retrieved from the region and printed to the console. | |
// Do a compound search on last name and email using analyzerIndex | ||
gfsh>search lucene --name=analyzerIndex --region=example-region --queryStrings="lastName:hall~ AND email:Kris.[email protected]" --defaultField=lastName | ||
|
||
// Do a compound search on nested object with both 5035330001 AND 5036430001 in either home or office. | ||
// Note: 5035330001 is one of his home phone, 5036430001 is one of his office phone. | ||
gfsh>search lucene --name=nestedObjectIndex --region=/example-region --queryString="5035330001 AND 5036430001" --defaultField=zipAndPhoneBook.phones | ||
|
||
// If query on 5035330001 AND 5036430002, it will not find the person, because the 2 phone numbers belong to different person's entry. | ||
gfsh>search lucene --name=nestedObjectIndex --region=/example-region --queryString="5035330001 AND 5036430002" --defaultField=zipAndPhoneBook.phones | ||
|
||
// If query on 5035330001 OR 5036430002, it will find 2 people's entries | ||
gfsh>search lucene --name=nestedObjectIndex --region=/example-region --queryString="5035330001 OR 5036430002" --defaultField=zipAndPhoneBook.phones | ||
|
||
3. Examine the Lucene index statistics | ||
|
||
gfsh>describe lucene index --name=simpleIndex --region=example-region | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
lucene/src/main/java/org/apache/geode/examples/lucene/ZipAndPhone.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work for additional information regarding | ||
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License. You may obtain a | ||
* copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package org.apache.geode.examples.lucene; | ||
|
||
import java.io.Serializable; | ||
import java.util.Arrays; | ||
|
||
public class ZipAndPhone implements Serializable { | ||
private int zip; | ||
private String[] phones; | ||
|
||
ZipAndPhone(int zip, String[] phones) { | ||
this.zip = zip; | ||
this.phones = phones; | ||
} | ||
|
||
public int getZip() { | ||
return this.zip; | ||
} | ||
|
||
public String[] getPhones() { | ||
return this.phones; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "(zip=" + zip + ", phones=" + Arrays.toString(phones) + ")"; | ||
} | ||
} |