Closed dadoonet closed 11 years ago
Hi David,
to be honest, I havent thought too much about it yet, but it should not be a problem. You have a need for this in order to use it in a client side application?
I need to check first, how pushing into sonatype OSS repo works, though :-)
--Alexander
Yes. By now, I upload your jar in my Company Nexus Repository, so that's fine enough. But, if I want to use your updates, it would be nice to have an easier process...
I want to embed your jar in my client side app (and this is relative to what I said in the mailing list about TransportClient and plugins - thanks for your answer BTW).
I have already published my first project in Sonatype OSS. The first time is a pain. I can help you if you need.
First, I think that you will have to modify the groupId as org.elasticsearch prefix belongs to Shay. Then, you will have to open a JIRA and ask for an account for your own groupId prefix.
For more information, you can have a look at my pom.xml file : https://github.com/dadoonet/spring-elasticsearch/blob/master/pom.xml Here is also my JIRA : https://issues.sonatype.org/browse/OSSRH-1434
The full guide is here : https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
HTH David.
FYI: https://issues.sonatype.org/browse/OSSRH-3754
will change groupid, add a correct license etc, asap...
Hey David,
just to keep you up-to-date. I have access to the maven repo now, but I do not have any free time at the moment - I am still trying to hunt down a file descriptor leak which prevents me from allowing the plugin to perform cool in production :-)
I'll try to tackle this in August. Big sorry for the delay, time is too short in the moment.
--Alexander
Thanks Alexander. Don't worry ! It's OSS ;-)
Hi David,
just a minor heads up: Right now I am fighting issues with 0.19.9, that it does not work when instantiating a TransportClient (and just spits) exceptions. Apparently I am trying to use features not available in the transport client - I need to resolve this first (as you might have seen on the mailinglist).
Any help is greatly appreciated :-)
I just pushed almost changes worth a full rewrite in the repository. You should be able use the plugin now with a TransportClient on another JVM than the one running elasticsearch on...
Releasing the plugin on a maven repo now got a lot useful :-)
Would be glad if you could test it a bit, i will do the same in the next days (the reason why I havent packaged it yet)
Hi Alexander,
Thanks for the follow up. Do I have to install your plugin on ES node and as a dependency in my client project? It make sense to me to have it on both sides. I was just wondering...
I will try to test it on the next days if I can have enough spare time...
Keep in touch
Hi,
yes, like the elasticsearch dependency you also have to incorporate the plugin in your client as well as into your server. In case you are using it via TransportClient, different modules are loaded.
hey David,
I've pushed an initial snapshot version at
Do you mind to take a small look at it before I do a real release? Would be grateful for any hints regarding the repo publishing stuff...
I'm starting to test it. Just a note. On the README, url goes to a 404 page : https://github.com/downloads/spinscale/elasticsearch-suggest-plugin/elasticsearch-suggest-0.1-0.19.10.zip Could you upload your SNAPSHOT version to https://github.com/downloads/spinscale/elasticsearch-suggest-plugin/elasticsearch-suggest-0.19.11-0.1-SNAPSHOT.zip ?
Thanks
First tests are working. I'm able to use your plugin with a TransportClient. I will report back soon.
fixed the readme issues. thanks for your testing patience...
Hey Alexander,
To me, everything is working fine.
FYI, here is my test case:
package org.elasticsearchfr.handson.ex9;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.suggest.SuggestRequestBuilder;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.ESLoggerFactory;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.junit.Assert;
import org.junit.Test;
/**
* We are testing the Suggest Plugin here: https://github.com/spinscale/elasticsearch-suggest-plugin
* @author David Pilato (aka dadoonet)
*/
public class SuggestPluginTest {
protected final ESLogger logger = ESLoggerFactory.getLogger(this.getClass().getName());
/**
* @throws Exception
*/
@Test
public void createSuggest() throws Exception {
Client client = null;
try {
client = new TransportClient().addTransportAddress(new InetSocketTransportAddress("localhost",9300));
client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
// Create index and mapping
String mapping = readFileInClasspath("/productmapping.json");
Assert.assertNotNull(mapping);
try {
client.admin().indices().prepareDelete("test").execute().actionGet();
} catch (org.elasticsearch.indices.IndexMissingException e) {
// If index does not exist, we should get an IndexMissingException: fine!
}
client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
client.admin().indices().prepareCreate("test").execute().actionGet();
client.admin().indices().preparePutMapping("test").setType("product").setSource(mapping).execute().actionGet();
client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
String json = null;
for (int i = 0; i < 10; i++) {
json = "{\"ProductId\": \""+ i +"\", \"ProductName\": \"my product "+ i +"\" }";
client.prepareIndex("test", "product").setSource(json).execute().actionGet();
}
client.admin().indices().prepareRefresh().execute().actionGet();
List<String> suggestions = new SuggestRequestBuilder(client)
.field("ProductName")
.term("my")
.size(10)
.similarity(2.0f)
.execute().actionGet().suggestions();
Assert.assertTrue(suggestions.size() > 0);
} catch (Exception e) {
logger.error("Error while running suggest test", e);
} finally {
if (client != null) client.close();
}
}
private static String readFileInClasspath(String url) throws Exception {
StringBuffer bufferJSON = new StringBuffer();
try {
InputStream ips= SuggestPluginTest.class.getResourceAsStream(url);
InputStreamReader ipsr = new InputStreamReader(ips);
BufferedReader br = new BufferedReader(ipsr);
String line;
while ((line=br.readLine())!=null){
bufferJSON.append(line);
}
br.close();
} catch (Exception e){
return null;
}
return bufferJSON.toString();
}
}
And the productmapping.json file:
{
"product" : {
"properties" : {
"ProductId": { "type": "string", "index": "not_analyzed" },
"ProductName" : {
"type" : "multi_field",
"fields" : {
"ProductName": { "type": "string", "index": "not_analyzed" },
"lowercase": { "type": "string", "analyzer": "lowercase_analyzer" },
"suggest" : { "type": "string", "analyzer": "suggest_analyzer" }
}
}
}
}
}
To me, you can release it.
Do you want a PR with this test case? If so, I will mark it as @Ignore
as you have to launch a Node outside the JUnit Classloader scope prior to run the test.
Cheers. David.
No pull request needed, I think my tests cover the above test (will verify at the weekend). Release is coming near
Thanks for your time and work. Hopefully, we can drop this plugin, when the SuggestAnalyzer comes with Lucene 4.1 and all will be available in elasticsearch
Heya,
Your artifact can not be downloaded as a maven dependency. It doesn't seem to exist in sonatype OSS repository. Do you planned to publish it as an artifact ?
Thanks David.