mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-10 06:55:32 +00:00
parent
2b4f875731
commit
b877f1bd4f
@ -7,7 +7,8 @@ In order to install the plugin, simply run: `bin/plugin -install elasticsearch/e
|
||||
|
||||
| Attachment Mapper Plugin | elasticsearch | Tika | Release date |
|
||||
|-----------------------------|-----------------------|--------|:------------:|
|
||||
| 1.10.0-SNAPSHOT (master) | 0.90.3 -> 0.90 | 1.4 | |
|
||||
| 2.0.0.RC1-SNAPSHOT (master) | 1.0.0.RC1 -> master | 1.4 | |
|
||||
| 1.10.0-SNAPSHOT (1.x) | 0.90.3 -> 0.90 | 1.4 | |
|
||||
| 1.9.0 | 0.90.3 -> 0.90 | 1.4 | 2013-08-20 |
|
||||
| 1.8.0 | 0.90.3 -> 0.90 | 1.2 | 2013-08-07 |
|
||||
| 1.7.0 | 0.90.0 -> 0.90.2 | 1.2 | 2013-02-26 |
|
||||
|
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch-mapper-attachments</artifactId>
|
||||
<version>1.10.0-SNAPSHOT</version>
|
||||
<version>2.0.0.RC1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<description>Mapper Attachments Type for ElasticSearch</description>
|
||||
<inceptionYear>2009</inceptionYear>
|
||||
@ -30,7 +30,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<elasticsearch.version>0.90.10</elasticsearch.version>
|
||||
<elasticsearch.version>1.0.0.RC1-SNAPSHOT</elasticsearch.version>
|
||||
<lucene.version>4.6.0</lucene.version>
|
||||
<tests.jvms>1</tests.jvms>
|
||||
<tests.shuffle>true</tests.shuffle>
|
||||
|
@ -41,7 +41,7 @@ public class DateAttachmentMapperTests extends ElasticsearchTestCase {
|
||||
|
||||
@Before
|
||||
public void setupMapperParser() {
|
||||
mapperParser = new DocumentMapperParser(new Index("test"), new AnalysisService(new Index("test")), null, null);
|
||||
mapperParser = new DocumentMapperParser(new Index("test"), new AnalysisService(new Index("test")), null, null, null);
|
||||
mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser());
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package org.elasticsearch.index.mapper.xcontent;
|
||||
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.index.Index;
|
||||
@ -27,6 +26,7 @@ import org.elasticsearch.index.analysis.AnalysisService;
|
||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||
import org.elasticsearch.index.mapper.DocumentMapperParser;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
import org.elasticsearch.index.mapper.ParseContext;
|
||||
import org.elasticsearch.index.mapper.attachment.AttachmentMapper;
|
||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||
import org.junit.Test;
|
||||
@ -47,7 +47,7 @@ public class EncryptedDocMapperTest extends ElasticsearchTestCase {
|
||||
|
||||
@Test
|
||||
public void testMultipleDocsEncryptedLast() throws IOException {
|
||||
DocumentMapperParser mapperParser = new DocumentMapperParser(new Index("test"), new AnalysisService(new Index("test")), null, null);
|
||||
DocumentMapperParser mapperParser = new DocumentMapperParser(new Index("test"), new AnalysisService(new Index("test")), null, null, null);
|
||||
mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser());
|
||||
|
||||
String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/multipledocs/test-mapping.json");
|
||||
@ -62,7 +62,7 @@ public class EncryptedDocMapperTest extends ElasticsearchTestCase {
|
||||
.field("file2", pdf)
|
||||
.endObject().bytes();
|
||||
|
||||
Document doc = docMapper.parse(json).rootDoc();
|
||||
ParseContext.Document doc = docMapper.parse(json).rootDoc();
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file1").mapper().names().indexName()), containsString("World"));
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file1.title").mapper().names().indexName()), equalTo("Hello"));
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file1.author").mapper().names().indexName()), equalTo("kimchy"));
|
||||
@ -80,7 +80,7 @@ public class EncryptedDocMapperTest extends ElasticsearchTestCase {
|
||||
|
||||
@Test
|
||||
public void testMultipleDocsEncryptedFirst() throws IOException {
|
||||
DocumentMapperParser mapperParser = new DocumentMapperParser(new Index("test"), new AnalysisService(new Index("test")), null, null);
|
||||
DocumentMapperParser mapperParser = new DocumentMapperParser(new Index("test"), new AnalysisService(new Index("test")), null, null, null);
|
||||
mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser());
|
||||
|
||||
String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/multipledocs/test-mapping.json");
|
||||
@ -95,7 +95,7 @@ public class EncryptedDocMapperTest extends ElasticsearchTestCase {
|
||||
.field("file2", html)
|
||||
.endObject().bytes();
|
||||
|
||||
Document doc = docMapper.parse(json).rootDoc();
|
||||
ParseContext.Document doc = docMapper.parse(json).rootDoc();
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file1").mapper().names().indexName()), nullValue());
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file1.title").mapper().names().indexName()), nullValue());
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file1.author").mapper().names().indexName()), nullValue());
|
||||
@ -115,7 +115,7 @@ public class EncryptedDocMapperTest extends ElasticsearchTestCase {
|
||||
public void testMultipleDocsEncryptedNotIgnoringErrors() throws IOException {
|
||||
DocumentMapperParser mapperParser = new DocumentMapperParser(new Index("test"),
|
||||
ImmutableSettings.builder().put("index.mapping.attachment.ignore_errors", false).build(),
|
||||
new AnalysisService(new Index("test")), null, null);
|
||||
new AnalysisService(new Index("test")), null, null, null);
|
||||
mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser());
|
||||
|
||||
String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/multipledocs/test-mapping.json");
|
||||
@ -130,7 +130,7 @@ public class EncryptedDocMapperTest extends ElasticsearchTestCase {
|
||||
.field("file2", html)
|
||||
.endObject().bytes();
|
||||
|
||||
Document doc = docMapper.parse(json).rootDoc();
|
||||
ParseContext.Document doc = docMapper.parse(json).rootDoc();
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file1").mapper().names().indexName()), nullValue());
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file1.title").mapper().names().indexName()), nullValue());
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file1.author").mapper().names().indexName()), nullValue());
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package org.elasticsearch.index.mapper.xcontent;
|
||||
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
@ -28,6 +27,7 @@ import org.elasticsearch.index.analysis.AnalysisService;
|
||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||
import org.elasticsearch.index.mapper.DocumentMapperParser;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
import org.elasticsearch.index.mapper.ParseContext;
|
||||
import org.elasticsearch.index.mapper.attachment.AttachmentMapper;
|
||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||
import org.junit.Test;
|
||||
@ -45,7 +45,7 @@ import static org.hamcrest.Matchers.*;
|
||||
public class MetadataMapperTest extends ElasticsearchTestCase {
|
||||
|
||||
protected void checkMeta(String filename, Settings settings, Long expectedDate, Long expectedLength) throws IOException {
|
||||
DocumentMapperParser mapperParser = new DocumentMapperParser(new Index("test"), settings, new AnalysisService(new Index("test")), null, null);
|
||||
DocumentMapperParser mapperParser = new DocumentMapperParser(new Index("test"), settings, new AnalysisService(new Index("test")), null, null, null);
|
||||
mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser());
|
||||
|
||||
String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/xcontent/test-mapping.json");
|
||||
@ -61,7 +61,7 @@ public class MetadataMapperTest extends ElasticsearchTestCase {
|
||||
.endObject()
|
||||
.endObject().bytes();
|
||||
|
||||
Document doc = docMapper.parse(json).rootDoc();
|
||||
ParseContext.Document doc = docMapper.parse(json).rootDoc();
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file").mapper().names().indexName()), containsString("World"));
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file.name").mapper().names().indexName()), equalTo(filename));
|
||||
if (expectedDate == null) {
|
||||
|
@ -42,7 +42,7 @@ public class MultifieldAttachmentMapperTests extends ElasticsearchTestCase {
|
||||
|
||||
@Before
|
||||
public void setupMapperParser() {
|
||||
mapperParser = new DocumentMapperParser(new Index("test"), new AnalysisService(new Index("test")), null, null);
|
||||
mapperParser = new DocumentMapperParser(new Index("test"), new AnalysisService(new Index("test")), null, null, null);
|
||||
mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser());
|
||||
}
|
||||
|
||||
|
@ -19,12 +19,12 @@
|
||||
|
||||
package org.elasticsearch.index.mapper.xcontent;
|
||||
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.analysis.AnalysisService;
|
||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||
import org.elasticsearch.index.mapper.DocumentMapperParser;
|
||||
import org.elasticsearch.index.mapper.ParseContext;
|
||||
import org.elasticsearch.index.mapper.attachment.AttachmentMapper;
|
||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||
import org.junit.Before;
|
||||
@ -45,7 +45,7 @@ public class SimpleAttachmentMapperTests extends ElasticsearchTestCase {
|
||||
|
||||
@Before
|
||||
public void setupMapperParser() {
|
||||
mapperParser = new DocumentMapperParser(new Index("test"), new AnalysisService(new Index("test")), null, null);
|
||||
mapperParser = new DocumentMapperParser(new Index("test"), new AnalysisService(new Index("test")), null, null, null);
|
||||
mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser());
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public class SimpleAttachmentMapperTests extends ElasticsearchTestCase {
|
||||
|
||||
BytesReference json = jsonBuilder().startObject().field("_id", 1).field("file", html).endObject().bytes();
|
||||
|
||||
Document doc = docMapper.parse(json).rootDoc();
|
||||
ParseContext.Document doc = docMapper.parse(json).rootDoc();
|
||||
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file.content_type").mapper().names().indexName()), equalTo("application/xhtml+xml"));
|
||||
assertThat(doc.get(docMapper.mappers().smartName("file.title").mapper().names().indexName()), equalTo("XHTML test document"));
|
||||
|
@ -26,12 +26,12 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.client.Requests.*;
|
||||
import static org.elasticsearch.client.Requests.putMappingRequest;
|
||||
import static org.elasticsearch.common.io.Streams.copyToBytesFromClasspath;
|
||||
import static org.elasticsearch.common.io.Streams.copyToStringFromClasspath;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.fieldQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.queryString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
@ -72,10 +72,11 @@ public class MultipleAttachmentIntegrationTests extends ElasticsearchIntegration
|
||||
index("test", "person", jsonBuilder().startObject().field("file1", html).field("file2", pdf).field("hello","world").endObject());
|
||||
refresh();
|
||||
|
||||
CountResponse countResponse = client().count(countRequest("test").query(fieldQuery("file1", "World"))).actionGet();
|
||||
|
||||
CountResponse countResponse = client().prepareCount("test").setQuery(queryString("World").defaultField("file1")).execute().get();
|
||||
assertThat(countResponse.getCount(), equalTo(1l));
|
||||
|
||||
countResponse = client().count(countRequest("test").query(fieldQuery("hello", "World"))).actionGet();
|
||||
countResponse = client().prepareCount("test").setQuery(queryString("World").defaultField("hello")).execute().get();
|
||||
assertThat(countResponse.getCount(), equalTo(1l));
|
||||
}
|
||||
|
||||
|
@ -26,12 +26,12 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.client.Requests.*;
|
||||
import static org.elasticsearch.client.Requests.putMappingRequest;
|
||||
import static org.elasticsearch.common.io.Streams.copyToBytesFromClasspath;
|
||||
import static org.elasticsearch.common.io.Streams.copyToStringFromClasspath;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.fieldQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.queryString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
@ -64,10 +64,10 @@ public class SimpleAttachmentIntegrationTests extends ElasticsearchIntegrationTe
|
||||
index("test", "person", jsonBuilder().startObject().field("file", html).endObject());
|
||||
refresh();
|
||||
|
||||
CountResponse countResponse = client().count(countRequest("test").query(fieldQuery("file.title", "test document"))).actionGet();
|
||||
CountResponse countResponse = client().prepareCount("test").setQuery(queryString("test document").defaultField("file.title")).execute().get();
|
||||
assertThat(countResponse.getCount(), equalTo(1l));
|
||||
|
||||
countResponse = client().count(countRequest("test").query(fieldQuery("file", "tests the ability"))).actionGet();
|
||||
countResponse = client().prepareCount("test").setQuery(queryString("tests the ability").defaultField("file")).execute().get();
|
||||
assertThat(countResponse.getCount(), equalTo(1l));
|
||||
}
|
||||
|
||||
@ -82,10 +82,10 @@ public class SimpleAttachmentIntegrationTests extends ElasticsearchIntegrationTe
|
||||
index("test", "person", jsonBuilder().startObject().field("file").startObject().field("content", txt).field("_indexed_chars", CONTENT_LENGTH_LIMIT).endObject());
|
||||
refresh();
|
||||
|
||||
CountResponse countResponse = client().count(countRequest("test").query(fieldQuery("file", "BeforeLimit"))).actionGet();
|
||||
CountResponse countResponse = client().prepareCount("test").setQuery(queryString("BeforeLimit").defaultField("file")).execute().get();
|
||||
assertThat(countResponse.getCount(), equalTo(1l));
|
||||
|
||||
countResponse = client().count(countRequest("test").query(fieldQuery("file", "AfterLimit"))).actionGet();
|
||||
countResponse = client().prepareCount("test").setQuery(queryString("AfterLimit").defaultField("file")).execute().get();
|
||||
assertThat(countResponse.getCount(), equalTo(0l));
|
||||
}
|
||||
|
||||
@ -100,10 +100,10 @@ public class SimpleAttachmentIntegrationTests extends ElasticsearchIntegrationTe
|
||||
index("test", "person", jsonBuilder().startObject().field("file").startObject().field("content", txt).field("_indexed_chars", CONTENT_LENGTH_LIMIT).endObject());
|
||||
refresh();
|
||||
|
||||
CountResponse countResponse = client().count(countRequest("test").query(fieldQuery("file", "Begin"))).actionGet();
|
||||
CountResponse countResponse = client().prepareCount("test").setQuery(queryString("Begin").defaultField("file")).execute().get();
|
||||
assertThat(countResponse.getCount(), equalTo(1l));
|
||||
|
||||
countResponse = client().count(countRequest("test").query(fieldQuery("file", "End"))).actionGet();
|
||||
countResponse = client().prepareCount("test").setQuery(queryString("End").defaultField("file")).execute().get();
|
||||
assertThat(countResponse.getCount(), equalTo(1l));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user