Package com.esri.gpt.catalog.discovery

Examples of com.esri.gpt.catalog.discovery.PropertyComparisonType


   */
  protected Query getFieldQuery(String field, String queryText, int slop) throws ParseException {
    Query q = null;
    PropertyMeaning meaning = resolveMeaning(field);
    if (meaning != null) {
      PropertyComparisonType type = meaning.getComparisonType();

      if (type == PropertyComparisonType.KEYWORD) {
        q = new TermQuery(new Term(field, Val.chkStr(queryText).toLowerCase()));
      }
      if (type == PropertyComparisonType.VALUE && meaning.getValueType() == PropertyValueType.STRING) {
View Full Code Here


   */
  protected Query getPrefixQuery(String field, String termStr) throws ParseException {
    Query q = null;
    PropertyMeaning meaning = resolveMeaning(field);
    if (meaning != null) {
      PropertyComparisonType type = meaning.getComparisonType();
     
      if (type == PropertyComparisonType.KEYWORD) {
        q = newPrefixQuery(field, Val.chkStr(termStr).toLowerCase());
      } else if (type == PropertyComparisonType.TERMS) {
        q = newPrefixQuery(field, Val.chkStr(termStr).toLowerCase());
View Full Code Here

   */
  protected Query getRangeQuery(String field, String part1, String part2, boolean inclusive) throws ParseException {
    Query q = null;
    PropertyMeaning meaning = resolveMeaning(field);
    if (meaning != null) {
      PropertyComparisonType type = meaning.getComparisonType();

      if (type == PropertyComparisonType.KEYWORD) {
        q = newRangeQuery(field, Val.chkStr(part1).toLowerCase(), Val.chkStr(part2).toLowerCase(), inclusive);
      }
      if (type == PropertyComparisonType.VALUE && meaning.getValueType() == PropertyValueType.STRING) {
View Full Code Here

   */
  protected Query getWildcardQuery(String field, String termStr) throws ParseException {
    Query q = null;
    PropertyMeaning meaning = resolveMeaning(field);
    if (meaning != null) {
      PropertyComparisonType type = meaning.getComparisonType();

      if (type == PropertyComparisonType.KEYWORD) {
        q = new WildcardQuery(new Term(field, Val.chkStr(termStr).toLowerCase()));
      }
      if (type == PropertyComparisonType.VALUE) {
View Full Code Here

   */
  protected Query getFuzzyQuery(String field, String termStr, float minSimilarity) throws ParseException {
    Query q = null;
    PropertyMeaning meaning = resolveMeaning(field);
    if (meaning != null) {
      PropertyComparisonType type = meaning.getComparisonType();

      if (type == PropertyComparisonType.KEYWORD) {
        q = new FuzzyQuery(new Term(field, Val.chkStr(termStr).toLowerCase()));
      }
      if (type == PropertyComparisonType.VALUE) {
View Full Code Here

   
    Storeable storable = null;
   
    String fieldName = meaning.getName();
    PropertyMeaningType meaningType = meaning.getMeaningType();
    PropertyComparisonType comparisonType = meaning.getComparisonType();
    PropertyValueType valueType = meaning.getValueType();
   
    if (meaning instanceof PropertyMeaning.AnyText) {
      PropertyMeaning.AnyText anyText = (PropertyMeaning.AnyText)meaning;
      storable = new AnyTextProperty(fieldName,anyText.getNamesToConsider());

    } else if (comparisonType.equals(PropertyComparisonType.ANYTEXT)) {
      storable = new AnyTextProperty(fieldName,new StringSet());
     
    } else if (fieldName.equalsIgnoreCase("body")) {
      storable = new Storeable(fieldName);
      DatastoreField field = new DatastoreField(fieldName,
          Field.Store.NO,Field.Index.ANALYZED,Field.TermVector.NO);
      storable.getFields().add(field);
           
    } else if (comparisonType.equals(PropertyComparisonType.KEYWORD)) {
      storable = new Storeable(fieldName);
      storable.setComparisonField(new LowerCaseField(fieldName));
      storable.setRetrievalField(new ReferenceField(fieldName+".ref"));
      storable.getFields().add(storable.getComparisonField());
      storable.getFields().add(storable.getRetrievalField());
     
    } else if (!meaningType.equals(PropertyMeaningType.DATEMODIFIED) &&
                valueType.equals(PropertyValueType.TIMESTAMP)) {
      storable = new Storeable(fieldName);
      storable.setComparisonField(new TimestampField(fieldName));
      storable.setTermsField(new TermsField(fieldName+".input"));
      storable.getFields().add(storable.getComparisonField());
      storable.getFields().add(storable.getTermsField());
      storable.setRetrievalField(storable.getComparisonField());
     
    } else if (comparisonType.equals(PropertyComparisonType.VALUE)) {
      DatastoreField field = null;
     
      if (valueType.equals(PropertyValueType.DOUBLE)) {
        field = new DoubleField(fieldName,DoubleField.DEFAULT_PRECISION);
       
      } else if (valueType.equals(PropertyValueType.GEOMETRY)) {
        storable = new GeometryProperty(fieldName);

      } else if (valueType.equals(PropertyValueType.TIMEPERIOD)) {
        storable = new TimeperiodProperty(fieldName);
       
      } else if (valueType.equals(PropertyValueType.LONG)) {
        field = new LongField(fieldName);
       
      } else if (valueType.equals(PropertyValueType.STRING)) {
        field = new DatastoreField(fieldName,
                    Field.Store.YES,Field.Index.NOT_ANALYZED,Field.TermVector.NO);
       
      } else if (valueType.equals(PropertyValueType.TIMESTAMP)) {
        field = new TimestampField(fieldName);
       
      } else {
       
        // TODO issue warning here (value type not recognized)
      }
      if (field != null) {
        storable = new Storeable(fieldName);
        storable.setComparisonField(field);
        storable.setRetrievalField(field);
        storable.getFields().add(field);
      }
     
    } else if (comparisonType.equals(PropertyComparisonType.TERMS)) {
      storable = new Storeable(fieldName);
      storable.setTermsField(new TermsField(fieldName));
      storable.setComparisonField(new LowerCaseField(fieldName+".lc"));
      storable.setRetrievalField(storable.getTermsField());
      storable.getFields().add(storable.getTermsField());
View Full Code Here

TOP

Related Classes of com.esri.gpt.catalog.discovery.PropertyComparisonType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.