Package com.esri.gpt.catalog.lucene

Examples of com.esri.gpt.catalog.lucene.LuceneQueryAdapter


    int startRecord = query.getFilter().getStartRecord();
    boolean returnIdsOnly = Val.chkBool(Val.chkStr(request.getParameter("returnIdsOnly")), false);
    if (returnIdsOnly) {
      startRecord = 1;
      query.getFilter().setMaxRecords(1);
      LuceneQueryAdapter tmp = new LuceneQueryAdapter();
      tmp.execute(context, query);
      query.getFilter().setMaxRecords(query.getResult().getNumberOfHits());
    }

    query.getFilter().setStartRecord(startRecord);
    LuceneQueryAdapter lqa = new LuceneQueryAdapter() {
      @Override
      protected void onRecord(DiscoveredRecord record, Document document) {
        Map<String, List<String>> fieldMap = new HashMap<String, List<String>>();
        for (Fieldable field : document.getFields()) {
          String name = field.name();
          List<String> fieldValues = fieldMap.get(name);
          if (fieldValues == null) {
            fieldValues = new ArrayList<String>();
            fieldMap.put(name, fieldValues);
          }
          fieldValues.add(field.stringValue());
        }
        mapping.put(record, fieldMap);
      }
    };
    lqa.execute(context, query);
    startRecord += query.getFilter().getMaxRecords();

    loadLuceneMeta(context, fields);

    OpenSearchProperties osProps = new OpenSearchProperties();
View Full Code Here


    int startRecord = query.getFilter().getStartRecord();
    boolean returnIdsOnly = Val.chkBool(Val.chkStr(request.getParameter("returnIdsOnly")), false);
    if (returnIdsOnly) {
      startRecord = 1;
      query.getFilter().setMaxRecords(1);
      LuceneQueryAdapter tmp = new LuceneQueryAdapter();
      tmp.execute(context, query);
      query.getFilter().setMaxRecords(query.getResult().getNumberOfHits());
    }

    query.getFilter().setStartRecord(startRecord);
    LuceneQueryAdapter lqa = new LuceneQueryAdapter() {
      @Override
      protected void onRecord(DiscoveredRecord record, Document document) {
        Map<String, List<String>> fieldMap = new HashMap<String, List<String>>();
        for (Fieldable field : document.getFields()) {
          String name = field.name();
          List<String> fieldValues = fieldMap.get(name);
          if (fieldValues == null) {
            fieldValues = new ArrayList<String>();
            fieldMap.put(name, fieldValues);
          }
          fieldValues.add(field.stringValue());
        }
        mapping.put(record, fieldMap);
      }
    };
    lqa.execute(context, query);
    startRecord += query.getFilter().getMaxRecords();

    loadLuceneMeta(context, fields);

    OpenSearchProperties osProps = new OpenSearchProperties();
View Full Code Here

TOP

Related Classes of com.esri.gpt.catalog.lucene.LuceneQueryAdapter

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.