org.geotools.data.Query.toString()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中org.geotools.data.Query.toString方法的一些代码示例,展示了Query.toString的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.toString方法的具体详情如下:
包路径:org.geotools.data.Query
类名称:Query
方法名:toString

Query.toString介绍

[英]Return a string representation of this Query.
[中]返回此查询的字符串表示形式。

代码示例

代码示例来源:origin: geotools/geotools

/** Test of toString method, of class org.geotools.data.Query. */
  public void testToString() {
    // System.out.println("testToString");
    Query query = new Query();
    assertNotNull(query.toString());

    query.setHandle("myquery");
    assertNotNull(query.toString());

    query.setFilter(Filter.EXCLUDE);
    assertNotNull(query.toString());

    query.setPropertyNames(new String[] {"foo", "bar"});
    assertNotNull(query.toString());

    query = new Query();
    query.setSortBy(new SortBy[] {SortBy.NATURAL_ORDER});
    assertTrue(query.toString().contains("[sort by: NATURAL]"));
    query.setSortBy(new SortBy[] {SortBy.REVERSE_ORDER});
    assertTrue(query.toString().contains("[sort by: REVERSE]"));
  }
}

代码示例来源:origin: geotools/geotools

/** Helper method that dets the features of the provided table that match the provided query. */
private List<SimpleFeature> getFeatures(String tableName, Query query) {
  try {
    ContentFeatureSource featureSource = dataStore.getFeatureSource(tname(tableName));
    SimpleFeatureCollection collection = featureSource.getFeatures(query);
    return getFeatures(collection);
  } catch (Exception exception) {
    // something bad happen, let's abort
    throw new RuntimeException(
        String.format(
            "Error reading features from table '%s' using query '%s'.",
            tableName, query.toString()),
        exception);
  }
}

代码示例来源:origin: geotools/geotools

if (indexes == null || indexes.isEmpty()) {
  if (LOGGER.isLoggable(Level.FINE)) {
    LOGGER.fine(" No indexes found for this query: " + query.toString());

代码示例来源:origin: stackoverflow.com

public void searchFromFilm_Text(String keyword) {
  try {
    IndexReader reader = DirectoryReader.open(FSDirectory.open(new File(AppConstants.INDEX_DIR)));
    IndexSearcher searcher = new IndexSearcher(reader);
    Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_46);
    QueryParser parser = new QueryParser(Version.LUCENE_46, "title", analyzer);            
    Query query = parser.parse(keyword);
    System.out.println("Searching for: " + query.toString("title"));
    TopDocs results = searcher.search(query, 100);             
    ScoreDoc[] hits = results.scoreDocs;
    System.out.println(hits.length);
    for(ScoreDoc sdoc : hits)
    {
      Document doc = searcher.doc(sdoc.doc);
      System.out.println(doc.get("id"));
      System.out.println(doc.get("title"));             
    }
  } catch (IOException ex) {
    Logger.getLogger(SearchManager.class.getName()).log(Level.SEVERE, null, ex);
  } catch (ParseException ex) {
    Logger.getLogger(SearchManager.class.getName()).log(Level.SEVERE, null, ex);
  }

}

代码示例来源:origin: stackoverflow.com

QueryParser parser = new QueryParser("content", new ClassicAnalyzer());
Query result = parser.parse(searchTerm);
searchTerm = result.toString("content");

代码示例来源:origin: stackoverflow.com

Query query = new Query();
query.addCriteria(
  new Criteria().andOperator(
    Criteria.where("field1").exists(true),
    Criteria.where("field1").ne(false)
  )
);

List<Foo> result = mongoTemplate.find(query, Foo.class);
System.out.println("query - " + query.toString());

for (Foo foo : result) {
  System.out.println("result - " + foo);
}

代码示例来源:origin: stackoverflow.com

Criteria[] arrayA = {dao.createQuery().criteria("test").equal(1), dao.createQuery().criteria("test").equal(3)};
Criteria[] arrayB = {dao.createQuery().criteria("test").equal(2), dao.createQuery().criteria("test").equal(4)};;
Query q = dao.createQuery();
q.and(
 q.or(arrayA),
 q.or(arrayB)
);
System.out.println(q.toString());

代码示例来源:origin: stackoverflow.com

System.out.println("Query: " + query.toString() + "\n");

代码示例来源:origin: org.geotools/gt-netcdf

if (indexes == null || indexes.isEmpty()) {
  if (LOGGER.isLoggable(Level.FINE)) {
    LOGGER.fine(" No indexes found for this query: " + query.toString());

代码示例来源:origin: org.geoserver.extension/imagemap

LOGGER.info("Definition Query: "+definitionQuery.toString());
if (!definitionQuery.equals(Query.ALL)) {
  if (q.equals(Query.ALL)) {

代码示例来源:origin: org.geoserver/gs-wms

LOGGER.log(Level.FINE, q.toString());

相关文章