forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move dense_vector and sparse_vector to module (elastic#43280)
- Loading branch information
1 parent
90a8589
commit 7c811f3
Showing
40 changed files
with
430 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
[role="xpack"] | ||
[testenv="basic"] | ||
[[dense-vector]] | ||
=== Dense vector datatype | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
[role="xpack"] | ||
[testenv="basic"] | ||
[[sparse-vector]] | ||
=== Sparse vector datatype | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
...apper-extras/src/main/java/org/elasticsearch/index/query/DocValuesWhitelistExtension.java
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...ras/src/main/resources/META-INF/services/org.elasticsearch.painless.spi.PainlessExtension
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
...es/mapper-extras/src/main/resources/org/elasticsearch/index/query/docvalues_whitelist.txt
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
...mapper-extras/src/test/java/org/elasticsearch/index/mapper/DenseVectorFieldTypeTests.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
...apper-extras/src/test/java/org/elasticsearch/index/mapper/SparseVectorFieldTypeTests.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...lugin/core/src/main/java/org/elasticsearch/xpack/core/vectors/VectorsFeatureSetUsage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.core.vectors; | ||
|
||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.xpack.core.XPackFeatureSet; | ||
import org.elasticsearch.xpack.core.XPackField; | ||
|
||
import java.io.IOException; | ||
|
||
public class VectorsFeatureSetUsage extends XPackFeatureSet.Usage { | ||
|
||
public VectorsFeatureSetUsage(StreamInput input) throws IOException { | ||
super(input); | ||
} | ||
|
||
public VectorsFeatureSetUsage(boolean available, boolean enabled) { | ||
super(XPackField.VECTORS, available, enabled); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
evaluationDependsOn(xpackModule('core')) | ||
|
||
apply plugin: 'elasticsearch.esplugin' | ||
|
||
esplugin { | ||
name 'vectors' | ||
description 'A plugin for working with vectors' | ||
classname 'org.elasticsearch.xpack.vectors.Vectors' | ||
extendedPlugins = ['x-pack-core', 'lang-painless'] | ||
} | ||
archivesBaseName = 'x-pack-vectors' | ||
|
||
dependencies { | ||
compileOnly project(':modules:lang-painless:spi') | ||
compileOnly project(path: xpackModule('core'), configuration: 'default') | ||
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts') | ||
if (isEclipse) { | ||
testCompile project(path: xpackModule('core-tests'), configuration: 'testArtifacts') | ||
} | ||
} | ||
|
||
integTest.enabled = false |
51 changes: 51 additions & 0 deletions
51
x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/Vectors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.vectors; | ||
|
||
import org.elasticsearch.common.inject.Module; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.index.mapper.Mapper; | ||
import org.elasticsearch.plugins.MapperPlugin; | ||
import org.elasticsearch.plugins.Plugin; | ||
import org.elasticsearch.xpack.core.XPackPlugin; | ||
import org.elasticsearch.xpack.core.XPackSettings; | ||
import org.elasticsearch.xpack.vectors.mapper.DenseVectorFieldMapper; | ||
import org.elasticsearch.xpack.vectors.mapper.SparseVectorFieldMapper; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
import static java.util.Collections.emptyMap; | ||
|
||
public class Vectors extends Plugin implements MapperPlugin { | ||
|
||
public static final String NAME = "vectors"; | ||
protected final boolean enabled; | ||
|
||
public Vectors(Settings settings) { | ||
this.enabled = XPackSettings.VECTORS_ENABLED.get(settings); | ||
} | ||
|
||
public Collection<Module> createGuiceModules() { | ||
return Collections.singletonList(b -> { | ||
XPackPlugin.bindFeatureSet(b, VectorsFeatureSet.class); | ||
}); | ||
} | ||
|
||
@Override | ||
public Map<String, Mapper.TypeParser> getMappers() { | ||
if (enabled == false) { | ||
return emptyMap(); | ||
} | ||
Map<String, Mapper.TypeParser> mappers = new LinkedHashMap<>(); | ||
mappers.put(DenseVectorFieldMapper.CONTENT_TYPE, new DenseVectorFieldMapper.TypeParser()); | ||
mappers.put(SparseVectorFieldMapper.CONTENT_TYPE, new SparseVectorFieldMapper.TypeParser()); | ||
return Collections.unmodifiableMap(mappers); | ||
} | ||
} |
Oops, something went wrong.