- 浏览: 105538 次
- 性别:
- 来自: 东营
文章分类
最新评论
-
ln987604356:
```说明都没得 看锤子
弹出 div jquery.jmpopups-0.5.1.js -
yanshaozhi:
snowolf 写道工作中的收获,远远不只是工资,但往往首先需 ...
完全成为了一个职员 -
snowolf:
工作中的收获,远远不只是工资,但往往首先需要考虑工资。因为你要 ...
完全成为了一个职员 -
onex:
相比于其他的那两位,我觉得你很不错。很欣赏你。 你继续抱着学习 ...
完全成为了一个职员
12.5.4. CompassQuery and CompassQueryBuilder Compass::Core comes with the CompassQueryBuilder interface, which provides programmatic API for building a query. The query builder creates a CompassQuery which can than be used to add sorting and executing the query. Working with objects Compass - Java Search Engine 108Using the CompassQueryBuilder, simple queries can be created (i.e. eq, between, prefix, fuzzy), and more complex query builders can be created as well (such as a boolean query, multi-phrase, and query string). The following code shows how to use a query string query builder and using the CompassQuery add sorting to the result. CompassHits hits = session.createQueryBuilder() .queryString("+name:jack +familyName:london") .setAnalyzer("an1") // use a different analyzer .toQuery() .addSort("familyName", CompassQuery.SortPropertyType.STRING) .addSort("birthdate", CompassQuery.SortPropertyType.INT) .hits(); Another example for building a query that requires the name to be jack, and the familyName not to be london: CompassQueryBuilder queryBuilder = session.createQueryBuilder(); CompassHits hits = queryBuilder.bool() .addMust( queryBuilder.term("name", "jack") ) .addMustNot( queryBuilder.term("familyName", "london") ) .toQuery() .addSort("familyName", CompassQuery.SortPropertyType.STRING) .addSort("birthdate", CompassQuery.SortPropertyType.INT) .hits(); CompassQuery can also be created using the Compass instance, without the need to construct a CompassSession. They can then stored and used safely by multiple sessions (in a multi threaded environment) by attaching them to the current session using CompassQuery#attach(CompssSession) API. Note that sorted resource properties / meta-data must be stored and not_analyzed. Also sorting requires more memory to keep sorting properties available. For numeric types, each property sorted requires four bytes to be cached for each resource in the index. For String types, each unique term needs to be cached. When a query is built, most of the queries can accept an Object as a parameter, and the name part can be more than just a simple string value of the meta-data / resource-property. If we take the following mapping for example: <class name="eg.A" alias="a"> <id name="id" /> <property name="familyName"> <meta-data>family-name</meta-data> </property> <property name="date"> <meta-data converter-param="YYYYMMDD">date-sem</meta-data> </property> </class> The mapping defines a simple class mapping, with a simple string property called familyName and a date property called date. With the CompassQueryBuilder, most of the queries can directly work with either level of the mappings. Here are some samples: CompassQueryBuilder queryBuilder = session.createQueryBuilder(); // The following search will result in matching "london" against "familyName" CompassHits hits = queryBuilder.term("a.familyName.family-name", "london").hits(); // The following search will use the class property meta-data id, which in this case // is the first one (family-name). If there was another meta-data with the family-name value, // the internal meta-data that is created will be used ($/a/familyName). CompassHits hits = queryBuilder.term("a.familyName", "london").hits(); // Here, we provide the Date object as a parameter, the query builder will use the Working with objects Framework (2.2.0 GA)// converter framework to convert the value (and use the given parameter) CompassHits hits = queryBuilder.term("a.date.date-sem", new Date()).hits(); // Remmember, that the alias constraint will not be added automatically, so // the following query will cause only family-name with the value "london" of alias "a" CompassHits hits = queryBuilder.bool() .addMust( queryBuilder.alias("a") ) .addMust( queryBuilder.term("a.familyName", "london") ) .toQuery().hits(); When using query strings and query parsers, Compass enhances Lucene query parser to support custom formats (for dates and numbers, for example) as well as support dot path notation. The query: a.familyname.family-name:london will result in a query matching on familyName to london as well as wrapping the query with one that will only match the a alias.
发表评论
-
Red5 的一点点感悟
2011-07-17 21:09 932最近一个项目需要用到客户端的录音功能,大概的方案就是Flex ... -
JFreechart 绘制闭合曲线
2011-06-28 14:25 829在网上搜了不少,但实现总是感觉有点难受,无奈还是要看API ... -
短信mao编码问题
2011-06-16 23:51 824最近一个项目要用到短信mao,乱码问题折腾了挺久,由于项目都是 ... -
itext 学习地址
2011-06-08 14:23 661http://www.roseindia.net/java/i ... -
Nutz 例子,从mvc ioc 到数据插入
2011-04-18 13:06 777create table rb_user( u ... -
设计模式
2010-03-13 14:16 604http://www.riabook.cn/doc/desig ... -
Lucene in Action 下载(英文)
2009-12-01 18:49 652防止丢了,就放这里了,顺便共享下! -
NSIS 设置系统变量
2009-07-01 11:04 1177;set env WriteRegExpandStr HK ... -
flex box 组件间隔
2009-06-25 12:23 926VBox 属性 verticalGap="0&quo ... -
java动态代理
2009-06-18 16:08 696被代理的对象 厂家 代理对象 商家 publ ... -
20 very useful Java code snippets for Java Develop
2009-05-20 11:07 11951. Converting Strings to int an ... -
git 设置 用户名和信箱
2009-05-14 11:09 19428Guides: Tell git your user name ... -
ubuntu install java
2009-05-04 11:33 856http://www.cyberciti.biz/faq/ho ... -
java png gif bmp to jpg
2009-04-23 11:17 1954File file = new File("d: ... -
flex 组合键实现
2009-04-01 13:25 3083可行: var ctrl:Boolean=event.ct ... -
eclipse 不能启动
2009-03-11 09:19 874eclipse.ini的配置如下: -showsplash ... -
hibernate 主键生成方式
2009-01-17 13:47 668对于SQLServer数据库在使用中如果将表的主键字段id设为 ... -
久违的jdbc样板代码
2009-01-17 11:52 810public class DB { private S ... -
InputSteam to OutputStream
2008-10-23 16:00 992InputStream in = node.getProper ... -
sling中配置servlet是否被访问到
2008-10-21 10:05 817@scr.property name="sling. ...
相关推荐
在“mongodb-compass-community-1.16.4-win32-x64.zip”这个压缩包中,包含了MongoDB Compass的社区版,它可以帮助用户直观地查看和操作MongoDB数据库。以下是压缩包内各个文件的作用: 1. **snapshot_blob.bin**:...
mongodb-windows安装包: mongodb-compass-1.31.2-win32-x64.msi 打开直接安装
mongodb-compass-community-1.21.2-win32-x64.exe mongodb-compass-community-1.21.2-win32-x64.exe mongodb-compass-community-1.21.2-win32-x64.exe mongodb-compass-community-1.21.2-win32-x64.exe
mongodb-compass-1.42.1-win32-x64.exe 数据库构建工具
mongodb可视化管理mongodb-compass-1.43.0-win32-x64.exe mongodb compass官网下载地址:https://www.mongodb.com/try/download/compass mongodb相关下载地址: mongodb社区版:...
mongodb-compass-community-1.18.0-win32-x64.msi
"mongodb-compass-1.27.1-win32-x64.zip"是一个针对Windows 64位系统的MongoDB Compass版本的压缩包。 MongoDB Compass的核心功能包括: 1. **数据可视化**:它提供了一个直观的界面来查看和理解数据库的结构,...
compass-interface-core-0.15.0,从名字上看,我们可以推测这是一个与指南针或方向相关的接口核心模块,很可能用于地理定位、地图导航或者其他与方向计算相关的应用。版本号0.15.0表明这是该库的一个稳定版本,但...
在这个版本"mongodb官方客户端可视化工具compass-1.26.1-win32-x64"中,我们关注的是Windows 32位和64位系统的版本。 Compass的主要功能包括: 1. 数据浏览:它允许用户以表格、图表或者JSON格式查看和编辑数据,...
MongoDB Compass是数据库MongoDB下的一款可视化操作工具,可以帮助我们更轻松的创建和管理数据库。
关于mongodb-compass-1.40.2-win32-x64.msi,这是一个MongoDB Compass的Windows平台安装包,专为64位系统设计。MongoDB Compass是MongoDB官方提供的一个图形化数据库管理工具,它集成了多种功能,如创建数据库、管理...
mongodb-compass-1.28.4-darwin-x64.dmg
在"mongodb-compass-community-1.12.8-win32-x64.exe"这个文件中,我们可以看到这是MongoDB Compass社区版的1.12.8版本,专为32位和64位Windows操作系统设计。这个安装程序允许用户在Windows环境下轻松安装并使用...
<compass-core-meta-data> <meta-data-group id="mycompass" displayName="MyCompass"> <description>MycompassMetaData <uri>http://com/darkhe/sample/mycompass</uri> <description>ProjectApplyalias ...
mongodb-compass-community-1.13.0-beta.4-win32-x64,官方无法下载的可以来这里下载。
3. 重新安装MongoDB Compass:如果问题依然存在,可能需要卸载并重新安装Compass,确保安装过程中没有遗漏任何依赖项。 在压缩包中包含`api-ms-win-crt-runtime-l1-1-0.dll`文件,可能是为了帮助那些遇到此类问题的...
mongodb-compass-community-1.16.3-win32-x64.exe 可移步百度网盘:链接: https://pan.baidu.com/s/1RcffFh0CYLSrN9F0FXie9Q 提取码: g53s
该版本可能包含了当时的最新功能更新或修复了一些已知问题,对于研究和使用Compass的历史发展轨迹具有参考价值。 GPS(全球定位系统)数据处理涉及到多个步骤,包括数据采集、预处理、坐标转换、误差校正等。...