我正在查看 http://euphonious-intuition.com/2012/08/more-complicated-mapping-in-elasticsearch/ ,它解释了ElasticSearch分析器.
我不理解有关使用不同搜索和索引分析器的部分.自定义映射的第二个例子如下:
- >索引分析器是edgeNgram
- >搜索分析器是:
"full_name":{
"filter":[
"standard",
"lowercase",
"asciifolding"
],
"type":"custom",
"tokenizer":"standard"
}
Run Code Online (Sandbox Code Playgroud)
如果我们希望查询"Race"不返回像*ra*pport和*rac*ial这样的结果,因为edgeNgram,为什么首先用edgeNgram索引它?
请解释一下不同分析仪有用的示例.
我得到了错误Unable to locate NamespaceHandler when using context:annotation-config运行(java -jar)一个由maven-assembly-plugin组装并包含我的项目及其所有依赖项的jar.
正如其他人在forum.springsource.org 线程(消息#7/8)上正确发现的那样,问题出现是因为文件META-INF/spring.handlers和META-INF/spring.schemas存在于不同的jar中,当maven-assembly-plugin在单个文件中重新打包jar时会被覆盖.
查看两个spring - *.jar文件的内容,您可以看到文件位于相对于类路径的相同位置
$ jar tf spring-oxm-3.0.3.RELEASE.jar
META-INF/spring.handlers
META-INF/spring.schemas
org/springframework/oxm/GenericMarshaller.class
...
$ jar tf spring-context-3.0.3.RELEASE.jar
META-INF/spring.handlers
META-INF/spring.schemas
org/springframework/context/ApplicationContext.class
Run Code Online (Sandbox Code Playgroud)
是不是可以将META-INF文件夹放在特定的包中?如果是这样,我建议的想法(希望它是适用的)是将META-INF/spring.shemas和META-INF/spring.handlers文件放在他们引用的包下面.
$ jar tf spring-oxm-3.0.3.RELEASE.jar
org/springframework/oxm/META-INF/spring.schemas
org/springframework/oxm/META-INF/spring.handlers
org/springframework/oxm/GenericMarshaller.class
...
$ jar tf spring-context-3.0.3.RELEASE.jar
org/springframework/context/META-INF/spring.handlers
org/springframework/context/META-INF/spring.schemas
org/springframework/context/ApplicationContext.class
Run Code Online (Sandbox Code Playgroud)
这样,在单个jar中合并时它们不会发生冲突.你怎么看待这件事?
假设我有这个:
$hello = "Hello, is StackOverflow a helpful website!? Yes!";
Run Code Online (Sandbox Code Playgroud)
我想删除标点符号,因此输出为:
hello_is_stackoverflow_a_helpful_website_yes
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
PS:我理解"真实"与真实之间的区别.
编辑:我也理解Boolean.TRUE是原语true的包装器,我的问题是 - 为什么原语boolean接受Boolean.TRUE作为值?例如,
boolean boolVar = Boolean.TRUE;
Run Code Online (Sandbox Code Playgroud)
似乎是一个有效的陈述.
我正在尝试修复一个问题,在我的应用程序中我有这个代码
try {
object1.method1();
} catch(Exception ex) {
JOptionPane.showMessageDialog(nulll, "Error: "+ex.getMessage());
}
Run Code Online (Sandbox Code Playgroud)
而object1会做类似的事情:
public void method1() {
//some code...
throw new RuntimeException("Cannot move file");
}
Run Code Online (Sandbox Code Playgroud)
我的选项窗格中出现了这样一个消息:
Error: java.lang.RuntimeException: Cannot move file
但是我使用的getMessage不是toString方法,所以不应该出现类的名称,对吧?
我做错了什么?我已经尝试了很多例外,甚至Exception本身.我希望解决这个问题,而不需要实现我自己的Exception子类
问题已解决 - 谢谢大家!
实际上是在SwingWorker的get()方法中调用了try和catch,它构造了一个ExecutionException从doInBackground抛出的异常()
我修复了这样做:
@Override
protected void done() {
try {
Object u = (Object) get();
//do whatever u want
} catch(ExecutionException ex) {
JOptionPane.showMessageDialog(null, "Error: "+ex.getCause().getMessage());
} catch(Exception ex) { …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用HttpsUrlConnection类向服务器发送请求.服务器有证书问题,所以我设置了一个信任所有东西的TrustManager,以及一个同样宽松的主机名验证器.当我直接提出请求时,这个管理器工作得很好,但是当我通过代理发送请求时似乎根本没有使用它.
我设置我的代理设置如下:
Properties systemProperties = System.getProperties();
systemProperties.setProperty( "http.proxyHost", "proxyserver" );
systemProperties.setProperty( "http.proxyPort", "8080" );
systemProperties.setProperty( "https.proxyHost", "proxyserver" );
systemProperties.setProperty( "https.proxyPort", "8080" );
Run Code Online (Sandbox Code Playgroud)
默认SSLSocketFactory的TrustManager设置如下:
SSLContext sslContext = SSLContext.getInstance( "SSL" );
// set up a TrustManager that trusts everything
sslContext.init( null, new TrustManager[]
{
new X509TrustManager()
{
public X509Certificate[] getAcceptedIssuers()
{
return null;
}
public void checkClientTrusted( X509Certificate[] certs, String authType )
{
// everything is trusted
}
public void checkServerTrusted( X509Certificate[] certs, String authType )
{
// everything is trusted
} …Run Code Online (Sandbox Code Playgroud) 我在iMac(Mac OS X 10.6.6)上安装了Java更新,其中包含jdk的1.6.0_24版本.我认为这个更新已经改变了jdk的目录结构,所以现在我无法在eclipse上配置它.在更新之前,我的eclipse与这条路径有关:/System/Library/Frameworks/JavaVM.Framework/Versions/Current/Home实际上这似乎是错误的.现在我无法将我的日食链接到jdk.也许这是正确的道路:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home但1.6.0.jdk不是目录,所以我无法在eclipse中选择它.
有没有人遇到过这个问题?我该如何解决?
我已经在2天后搜索了这个.我使用sense chrome插件来测试我的查询,但我找不到如何指定他应该搜索哪个索引.所以我的查询搜索所有索引,并不容易使用.
我尝试了以下语法:
GET _search
{
"query": {
"term": {
"_index": {
"value": "dev_events2"
}
}
}
}
GET _search
{
"_index": "dev_events2",
"query": {
"match_all" : { }
}
}
GET _search
{
"index": "dev_events2",
"query": {
"match_all" : { }
}
}
Run Code Online (Sandbox Code Playgroud)
问候,
本杰明五世
编辑我终于找到了答案:只需将索引名称添加到get:localhost:9201/myIndexName的url中
对于其他弹性搜索开发者来说可能是一个非常容易(和愚蠢)的问题,这两者之间有什么区别?
我正在从Java webapp连接到远程elasticsearch服务器,到目前为止我一直在使用TransportClient,但我想知道是否可以使用NodeBuilder,或者NodeBuilder应该只用于嵌入式客户端?
如果两者中的任何一个都可用于连接远程ES服务器,哪个应该在内存和性能方面更好?
如果有人能指出我连接到远程ES服务器的NodeBuilder示例会很棒,因为我没有任何幸运的发现.
谢谢.