From cddc54f257b16c74a10ec2154781e5ba94fa7e74 Mon Sep 17 00:00:00 2001 From: Matthijs Brouwer <matthijs@brouwer.info> Date: Sun, 10 Jun 2018 19:41:02 +0200 Subject: [PATCH] include version information --- pom.xml | 16 ++++++++++++++++ src/main/java/mtas/analysis/parser/MtasPennTreebankParser.java | 3 --- src/main/java/mtas/codec/util/CodecCollector.java | 2 -- src/main/java/mtas/codec/util/CodecComponent.java | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------- src/main/java/mtas/solr/handler/component/MtasSolrSearchComponent.java | 16 +++++++++++++++- src/main/java/mtas/solr/handler/component/util/MtasSolrComponent.java | 1 - src/main/java/mtas/solr/handler/component/util/MtasSolrComponentFacet.java | 1 - src/main/java/mtas/solr/handler/component/util/MtasSolrComponentStatus.java | 6 ------ src/main/java/mtas/solr/handler/component/util/MtasSolrComponentTermvector.java | 1 - src/main/java/mtas/solr/handler/component/util/MtasSolrComponentVersion.java | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/mtas/solr/handler/component/util/MtasSolrResultUtil.java | 1 - src/main/java/mtas/solr/handler/util/MtasSolrStatus.java | 2 -- src/main/java/mtas/solr/search/MtasJoinQParser.java | 2 -- src/main/java/mtas/solr/search/MtasSolrJoinQParserPlugin.java | 7 ------- src/main/java/mtas/solr/update/processor/MtasUpdateRequestProcessorFactory.java | 3 --- src/main/resources/project.properties | 4 ++++ src/site/markdown/search_component_version.md | 29 +++++++++++++++++++++++++++++ src/site/site.xml | 3 ++- src/test/java/mtas/solr/MtasSolrTestDistributedSearchConsistency.java | 3 --- 19 files changed, 314 insertions(+), 105 deletions(-) create mode 100644 src/main/java/mtas/solr/handler/component/util/MtasSolrComponentVersion.java create mode 100644 src/main/resources/project.properties create mode 100644 src/site/markdown/search_component_version.md diff --git a/pom.xml b/pom.xml index 76b840d..694c75e 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,22 @@ </developer> </developers> <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>project.properties</include> + </includes> + <filtering>true</filtering> + </resource> + <resource> + <directory>src/main/resources</directory> + <excludes> + <exclude>project.properties</exclude> + </excludes> + <filtering>false</filtering> + </resource> + </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/src/main/java/mtas/analysis/parser/MtasPennTreebankParser.java b/src/main/java/mtas/analysis/parser/MtasPennTreebankParser.java index d6f866a..083386b 100644 --- a/src/main/java/mtas/analysis/parser/MtasPennTreebankParser.java +++ b/src/main/java/mtas/analysis/parser/MtasPennTreebankParser.java @@ -3,11 +3,8 @@ package mtas.analysis.parser; import java.io.IOException; import java.io.Reader; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.regex.Matcher; diff --git a/src/main/java/mtas/codec/util/CodecCollector.java b/src/main/java/mtas/codec/util/CodecCollector.java index eb6b049..88ab4b0 100644 --- a/src/main/java/mtas/codec/util/CodecCollector.java +++ b/src/main/java/mtas/codec/util/CodecCollector.java @@ -21,8 +21,6 @@ import java.util.SortedSet; import java.util.TimeZone; import java.util.TreeMap; import java.util.regex.Pattern; -import java.util.stream.Collectors; - import mtas.analysis.token.MtasToken; import mtas.analysis.token.MtasTokenString; import mtas.codec.MtasCodecPostingsFormat; diff --git a/src/main/java/mtas/codec/util/CodecComponent.java b/src/main/java/mtas/codec/util/CodecComponent.java index 02857dd..d4796a1 100644 --- a/src/main/java/mtas/codec/util/CodecComponent.java +++ b/src/main/java/mtas/codec/util/CodecComponent.java @@ -34,9 +34,6 @@ import mtas.analysis.token.MtasToken; import mtas.analysis.token.MtasTokenString; import mtas.codec.util.CodecSearchTree.MtasTreeHit; import mtas.codec.util.collector.MtasDataCollector; -import mtas.codec.util.distance.LevenshteinDistance; -import mtas.codec.util.distance.MorseDistance; -import mtas.codec.util.distance.DamerauLevenshteinDistance; import mtas.codec.util.distance.Distance; import mtas.parser.function.MtasFunctionParser; import mtas.parser.function.ParseException; @@ -50,6 +47,7 @@ import org.apache.lucene.util.BytesRef; import org.noggit.JSONParser; import org.noggit.ObjectBuilder; +// TODO: Auto-generated Javadoc /** * The Class CodecComponent. */ @@ -67,7 +65,11 @@ public class CodecComponent { */ public static class ComponentFields { + /** The status. */ public ComponentStatus status; + + /** The version. */ + public ComponentVersion version; /** The list. */ public Map<String, ComponentField> list; @@ -113,6 +115,9 @@ public class CodecComponent { /** The do status. */ public boolean doStatus; + + /** The do version. */ + public boolean doVersion; /** * Instantiates a new component fields. @@ -134,6 +139,7 @@ public class CodecComponent { doFacet = false; doCollection = false; doStatus = false; + doVersion = false; } } @@ -1338,56 +1344,32 @@ public class CodecComponent { /** * Instantiates a new component term vector. * - * @param key - * the key - * @param prefix - * the prefix - * @param distanceKey - * the distance key - * @param distanceType - * the distance type - * @param distanceBase - * the distance base - * @param distanceParameter - * the distance parameter - * @param distanceMaximum - * the distance maximum - * @param regexp - * the regexp - * @param full - * the full - * @param type - * the type - * @param sortType - * the sort type - * @param sortDirection - * the sort direction - * @param startValue - * the start value - * @param number - * the number - * @param functionKey - * the function key - * @param functionExpression - * the function expression - * @param functionType - * the function type - * @param boundary - * the boundary - * @param list - * the list - * @param listRegexp - * the list regexp - * @param ignoreRegexp - * the ignore regexp - * @param ignoreList - * the ignore list - * @param ignoreListRegexp - * the ignore list regexp - * @throws IOException - * Signals that an I/O exception has occurred. - * @throws ParseException - * the parse exception + * @param key the key + * @param prefix the prefix + * @param distanceKey the distance key + * @param distanceType the distance type + * @param distanceBase the distance base + * @param distanceParameter the distance parameter + * @param distanceMinimum the distance minimum + * @param distanceMaximum the distance maximum + * @param regexp the regexp + * @param full the full + * @param type the type + * @param sortType the sort type + * @param sortDirection the sort direction + * @param startValue the start value + * @param number the number + * @param functionKey the function key + * @param functionExpression the function expression + * @param functionType the function type + * @param boundary the boundary + * @param list the list + * @param listRegexp the list regexp + * @param ignoreRegexp the ignore regexp + * @param ignoreList the ignore list + * @param ignoreListRegexp the ignore list regexp + * @throws IOException Signals that an I/O exception has occurred. + * @throws ParseException the parse exception */ @SuppressWarnings({ "unchecked", "rawtypes" }) public ComponentTermVector(String key, String prefix, String[] distanceKey, @@ -1571,15 +1553,39 @@ public class CodecComponent { */ public static class ComponentStatus implements BasicComponent { + /** The handler. */ public String handler; + + /** The name. */ public String name; + + /** The key. */ public String key; + + /** The number of documents. */ public Integer numberOfDocuments; + + /** The number of segments. */ public Integer numberOfSegments; + + /** The get mtas handler. */ public boolean getMtasHandler; + + /** The get number of documents. */ public boolean getNumberOfDocuments; + + /** The get number of segments. */ public boolean getNumberOfSegments; + /** + * Instantiates a new component status. + * + * @param name the name + * @param key the key + * @param getMtasHandler the get mtas handler + * @param getNumberOfDocuments the get number of documents + * @param getNumberOfSegments the get number of segments + */ public ComponentStatus(String name, String key, boolean getMtasHandler, boolean getNumberOfDocuments, boolean getNumberOfSegments) { this.name = Objects.requireNonNull(name, "no name"); @@ -1593,7 +1599,17 @@ public class CodecComponent { } } + + /** + * The Class ComponentVersion. + */ + public static class ComponentVersion implements BasicComponent { + public ComponentVersion() { + + } + } + /** * The Interface ComponentStats. */ @@ -1926,6 +1942,7 @@ public class CodecComponent { /** The version. */ public String version; + /** The original version. */ public String originalVersion; /** The id. */ @@ -2025,12 +2042,10 @@ public class CodecComponent { /** * Sets the post variables. * - * @param id - * the id - * @param values - * the values - * @throws IOException - * Signals that an I/O exception has occurred. + * @param id the id + * @param values the values + * @param originalVersion the original version + * @throws IOException Signals that an I/O exception has occurred. */ public void setPostVariables(String id, HashSet<String> values, String originalVersion) throws IOException { @@ -2169,6 +2184,12 @@ public class CodecComponent { return action; } + /** + * Original version. + * + * @return the string + * @throws IOException Signals that an I/O exception has occurred. + */ public String originalVersion() throws IOException { if(action.equals(ACTION_POST)) { return originalVersion; @@ -2282,6 +2303,7 @@ public class CodecComponent { /** The prefix. */ public String prefix; + /** The minimum. */ public Double minimum; /** The maximum. */ @@ -2305,18 +2327,13 @@ public class CodecComponent { /** * Instantiates a new sub component distance. * - * @param key - * the key - * @param type - * the type - * @param prefix - * the prefix - * @param base - * the base - * @param parameters - * the parameters - * @param maximum - * the maximum + * @param key the key + * @param type the type + * @param prefix the prefix + * @param base the base + * @param parameters the parameters + * @param minimum the minimum + * @param maximum the maximum */ public SubComponentDistance(String key, String type, String prefix, String base, Map<String, String> parameters, String minimum, String maximum) { @@ -2361,6 +2378,12 @@ public class CodecComponent { return distance; } + /** + * Creates the class name. + * + * @param type the type + * @return the string + */ private String createClassName(String type) { final char DASH = '-'; Objects.requireNonNull(type, "Type is obligatory"); diff --git a/src/main/java/mtas/solr/handler/component/MtasSolrSearchComponent.java b/src/main/java/mtas/solr/handler/component/MtasSolrSearchComponent.java index 2d40d83..e8e6870 100644 --- a/src/main/java/mtas/solr/handler/component/MtasSolrSearchComponent.java +++ b/src/main/java/mtas/solr/handler/component/MtasSolrSearchComponent.java @@ -38,6 +38,8 @@ import mtas.solr.handler.component.util.MtasSolrComponentPrefix; import mtas.solr.handler.component.util.MtasSolrComponentStats; import mtas.solr.handler.component.util.MtasSolrComponentStatus; import mtas.solr.handler.component.util.MtasSolrComponentTermvector; +import mtas.solr.handler.component.util.MtasSolrComponentVersion; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.solr.common.params.CommonParams; @@ -156,6 +158,8 @@ public class MtasSolrSearchComponent extends SearchComponent { /** The search status. */ private MtasSolrComponentStatus searchStatus; + + private MtasSolrComponentVersion searchVersion; /** The collection cache. */ private MtasSolrCollectionCache collectionCache = null; @@ -178,6 +182,7 @@ public class MtasSolrSearchComponent extends SearchComponent { super.init(args); // init components searchStatus = new MtasSolrComponentStatus(this); + searchVersion = new MtasSolrComponentVersion(this); searchDocument = new MtasSolrComponentDocument(this); searchKwic = new MtasSolrComponentKwic(this); searchList = new MtasSolrComponentList(this); @@ -261,6 +266,11 @@ public class MtasSolrSearchComponent extends SearchComponent { mtasSolrResultMerge = new MtasSolrResultMerge(); // prepare components ComponentFields mtasFields = new ComponentFields(); + // get settings version + if (rb.req.getParams() + .getBool(MtasSolrComponentVersion.PARAM_MTAS_VERSION, false)) { + searchVersion.prepare(rb, mtasFields); + } // get settings status if (rb.req.getParams() .getBool(MtasSolrComponentStatus.PARAM_MTAS_STATUS, false)) { @@ -357,7 +367,7 @@ public class MtasSolrSearchComponent extends SearchComponent { if (mtasFields.doStats || mtasFields.doDocument || mtasFields.doKwic || mtasFields.doList || mtasFields.doGroup || mtasFields.doFacet || mtasFields.doCollection || mtasFields.doTermVector - || mtasFields.doPrefix || mtasFields.doStatus) { + || mtasFields.doPrefix || mtasFields.doStatus || mtasFields.doVersion) { SolrIndexSearcher searcher = rb.req.getSearcher(); ArrayList<Integer> docSetList = null; ArrayList<Integer> docListList = null; @@ -396,6 +406,10 @@ public class MtasSolrSearchComponent extends SearchComponent { collection); } NamedList<Object> mtasResponse = new SimpleOrderedMap<>(); + if (mtasFields.doVersion) { + SimpleOrderedMap<Object> versionResponse = searchVersion.create(mtasFields.version, false); + mtasResponse.add(MtasSolrComponentVersion.NAME, versionResponse); + } if (mtasFields.doStatus) { // add to response SimpleOrderedMap<Object> statusResponse = searchStatus diff --git a/src/main/java/mtas/solr/handler/component/util/MtasSolrComponent.java b/src/main/java/mtas/solr/handler/component/util/MtasSolrComponent.java index 2911ccd..2eb55d6 100644 --- a/src/main/java/mtas/solr/handler/component/util/MtasSolrComponent.java +++ b/src/main/java/mtas/solr/handler/component/util/MtasSolrComponent.java @@ -9,7 +9,6 @@ import org.apache.solr.handler.component.ShardRequest; import mtas.codec.util.CodecComponent.BasicComponent; import mtas.codec.util.CodecComponent.ComponentFields; -import mtas.solr.handler.MtasRequestHandler; /** * The Interface MtasSolrComponent. diff --git a/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentFacet.java b/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentFacet.java index e28d6c7..b1aa6f8 100644 --- a/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentFacet.java +++ b/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentFacet.java @@ -8,7 +8,6 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.lucene.index.DocValuesType; import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.SimpleOrderedMap; import org.apache.solr.handler.component.ResponseBuilder; diff --git a/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentStatus.java b/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentStatus.java index 8af47a8..1a40450 100644 --- a/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentStatus.java +++ b/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentStatus.java @@ -1,21 +1,15 @@ package mtas.solr.handler.component.util; import java.io.IOException; -import java.util.Map.Entry; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.solr.common.params.ShardParams; import org.apache.solr.common.util.SimpleOrderedMap; -import org.apache.solr.core.SolrInfoBean; import org.apache.solr.handler.component.ResponseBuilder; import org.apache.solr.handler.component.SearchComponent; import org.apache.solr.handler.component.ShardRequest; -import mtas.codec.util.Status; import mtas.codec.util.CodecComponent.ComponentFields; import mtas.codec.util.CodecComponent.ComponentStatus; -import mtas.solr.handler.MtasRequestHandler; import mtas.solr.handler.MtasRequestHandler.ShardInformation; import mtas.solr.handler.component.MtasSolrSearchComponent; diff --git a/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentTermvector.java b/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentTermvector.java index 84973f2..06ca7e6 100644 --- a/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentTermvector.java +++ b/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentTermvector.java @@ -2,7 +2,6 @@ package mtas.solr.handler.component.util; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; diff --git a/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentVersion.java b/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentVersion.java new file mode 100644 index 0000000..88dd056 --- /dev/null +++ b/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentVersion.java @@ -0,0 +1,154 @@ +package mtas.solr.handler.component.util; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.solr.common.util.SimpleOrderedMap; +import org.apache.solr.handler.component.ResponseBuilder; +import org.apache.solr.handler.component.SearchComponent; +import org.apache.solr.handler.component.ShardRequest; + +import mtas.codec.util.CodecComponent.ComponentFields; +import mtas.codec.util.CodecComponent.ComponentVersion; +import mtas.solr.handler.component.MtasSolrSearchComponent; + +// TODO: Auto-generated Javadoc +/** + * The Class MtasSolrComponentStatus. + */ +public class MtasSolrComponentVersion + implements MtasSolrComponent<ComponentVersion> { + + /** The Constant log. */ + private static final Log log = LogFactory + .getLog(MtasSolrComponentVersion.class); + + /** The search component. */ + MtasSolrSearchComponent searchComponent; + + String propertyVersion = null; + + String propertyArtifactId = null; + + String propertyGroupId = null; + + String propertyTimestamp = null; + + /** The Constant NAME. */ + public static final String NAME = "version"; + + /** The Constant PARAM_MTAS_VERSION. */ + public static final String PARAM_MTAS_VERSION = MtasSolrSearchComponent.PARAM_MTAS + + "." + NAME; + + public static final String NAME_MTAS_VERSION_VERSION = "version"; + + public static final String NAME_MTAS_VERSION_GROUPID = "groupId"; + + public static final String NAME_MTAS_VERSION_ARTIFACTID = "artifactId"; + + public static final String NAME_MTAS_VERSION_TIMESTAMP = "timestamp"; + + /** + * Instantiates a new mtas solr component status. + * + * @param searchComponent + * the search component + */ + public MtasSolrComponentVersion(MtasSolrSearchComponent searchComponent) { + this.searchComponent = searchComponent; + String resourceName = "project.properties"; // could also be a constant + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + Properties props = new Properties(); + try(InputStream resourceStream = loader.getResourceAsStream(resourceName)) { + props.load(resourceStream); + propertyVersion = props.getProperty(NAME_MTAS_VERSION_VERSION); + propertyArtifactId = props.getProperty(NAME_MTAS_VERSION_ARTIFACTID); + propertyGroupId = props.getProperty(NAME_MTAS_VERSION_GROUPID); + propertyTimestamp = props.getProperty(NAME_MTAS_VERSION_TIMESTAMP); + } catch (IOException e) { + log.info("couldn't read project.properties: "+e.getMessage()); + } + } + + /* + * (non-Javadoc) + * + * @see + * mtas.solr.handler.component.util.MtasSolrComponent#prepare(org.apache.solr. + * handler.component.ResponseBuilder, + * mtas.codec.util.CodecComponent.ComponentFields) + */ + @Override + public void prepare(ResponseBuilder rb, ComponentFields mtasFields) + throws IOException { + mtasFields.doVersion = true; + mtasFields.version = new ComponentVersion(); + } + + /* + * (non-Javadoc) + * + * @see + * mtas.solr.handler.component.util.MtasSolrComponent#create(mtas.codec.util. + * CodecComponent.BasicComponent, java.lang.Boolean) + */ + @Override + public SimpleOrderedMap<Object> create(ComponentVersion version, Boolean encode) + throws IOException { + SimpleOrderedMap<Object> mtasVersionResponse = new SimpleOrderedMap<>(); + mtasVersionResponse.add(NAME_MTAS_VERSION_GROUPID, propertyGroupId); + mtasVersionResponse.add(NAME_MTAS_VERSION_ARTIFACTID, propertyArtifactId); + mtasVersionResponse.add(NAME_MTAS_VERSION_VERSION, propertyVersion); + mtasVersionResponse.add(NAME_MTAS_VERSION_TIMESTAMP, propertyTimestamp); + return mtasVersionResponse; + + } + + /* + * (non-Javadoc) + * + * @see + * mtas.solr.handler.component.util.MtasSolrComponent#modifyRequest(org.apache + * .solr.handler.component.ResponseBuilder, + * org.apache.solr.handler.component.SearchComponent, + * org.apache.solr.handler.component.ShardRequest) + */ + @Override + public void modifyRequest(ResponseBuilder rb, SearchComponent who, + ShardRequest sreq) { + sreq.params.remove(PARAM_MTAS_VERSION); + } + + /* + * (non-Javadoc) + * + * @see + * mtas.solr.handler.component.util.MtasSolrComponent#finishStage(org.apache. + * solr.handler.component.ResponseBuilder) + */ + @Override + public void finishStage(ResponseBuilder rb) { + // TODO Auto-generated method stub + + } + + /* + * (non-Javadoc) + * + * @see + * mtas.solr.handler.component.util.MtasSolrComponent#distributedProcess(org. + * apache.solr.handler.component.ResponseBuilder, + * mtas.codec.util.CodecComponent.ComponentFields) + */ + @Override + public void distributedProcess(ResponseBuilder rb, ComponentFields mtasFields) + throws IOException { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/mtas/solr/handler/component/util/MtasSolrResultUtil.java b/src/main/java/mtas/solr/handler/component/util/MtasSolrResultUtil.java index 28e202e..1dbc467 100644 --- a/src/main/java/mtas/solr/handler/component/util/MtasSolrResultUtil.java +++ b/src/main/java/mtas/solr/handler/component/util/MtasSolrResultUtil.java @@ -10,7 +10,6 @@ import java.io.Reader; import java.io.Serializable; import java.io.StringReader; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; diff --git a/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java b/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java index a36b357..efe8427 100644 --- a/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java +++ b/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java @@ -1,8 +1,6 @@ package mtas.solr.handler.util; import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; diff --git a/src/main/java/mtas/solr/search/MtasJoinQParser.java b/src/main/java/mtas/solr/search/MtasJoinQParser.java index b7f997c..01459d3 100644 --- a/src/main/java/mtas/solr/search/MtasJoinQParser.java +++ b/src/main/java/mtas/solr/search/MtasJoinQParser.java @@ -1,8 +1,6 @@ package mtas.solr.search; import java.io.IOException; -import java.util.Arrays; - import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Query; diff --git a/src/main/java/mtas/solr/search/MtasSolrJoinQParserPlugin.java b/src/main/java/mtas/solr/search/MtasSolrJoinQParserPlugin.java index ed6d686..7dc58f3 100644 --- a/src/main/java/mtas/solr/search/MtasSolrJoinQParserPlugin.java +++ b/src/main/java/mtas/solr/search/MtasSolrJoinQParserPlugin.java @@ -1,18 +1,11 @@ package mtas.solr.search; -import java.io.IOException; - import org.apache.solr.common.params.SolrParams; import org.apache.solr.common.util.NamedList; -import org.apache.solr.core.CoreContainer; -import org.apache.solr.core.PluginBag.PluginHolder; -import org.apache.solr.handler.component.SearchComponent; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.search.QParser; import org.apache.solr.search.QParserPlugin; -import mtas.solr.handler.component.MtasSolrSearchComponent; - /** * The Class MtasSolrJoinQParserPlugin. */ diff --git a/src/main/java/mtas/solr/update/processor/MtasUpdateRequestProcessorFactory.java b/src/main/java/mtas/solr/update/processor/MtasUpdateRequestProcessorFactory.java index 8292955..545997c 100644 --- a/src/main/java/mtas/solr/update/processor/MtasUpdateRequestProcessorFactory.java +++ b/src/main/java/mtas/solr/update/processor/MtasUpdateRequestProcessorFactory.java @@ -7,12 +7,9 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; diff --git a/src/main/resources/project.properties b/src/main/resources/project.properties new file mode 100644 index 0000000..10c3fe6 --- /dev/null +++ b/src/main/resources/project.properties @@ -0,0 +1,4 @@ +version=${project.version} +artifactId=${project.artifactId} +groupId=${project.groupId} +timestamp=${timestamp} diff --git a/src/site/markdown/search_component_version.md b/src/site/markdown/search_component_version.md new file mode 100644 index 0000000..2d574f9 --- /dev/null +++ b/src/site/markdown/search_component_version.md @@ -0,0 +1,29 @@ +#Version + +Mtas provides a method to display information about `artifactId`, `groupId`, `version` and `timestamp` from the build. + +To include this information, in Solr requests, besides the parameter to enable the [Mtas query component](search_component.html), the following parameter should be provided. + +| Parameter | Value | Obligatory | +|-----------------------|--------|-------------| +| mtas.version | true | yes | + +--- + +**Example** +Inlcude Mtas build information + + +**Request and response** +`q=*:*&rows=0&wt=json&mtas=true&mtas.version=true` + +```json +"mtas":{ + "version":{ + "groupId":"org.textexploration.mtas", + "artifactId":"mtas", + "version":"7.3.1.1-SNAPSHOT", + "timestamp":"2018-06-10 12:25"}} +``` + + diff --git a/src/site/site.xml b/src/site/site.xml index f4ee1a6..5a7d081 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -52,7 +52,8 @@ <item name="Facet" href="search_component_facet.html"/> <item name="Group" href="search_component_group.html"/> <item name="Prefix" href="search_component_prefix.html"/> - <item name="Collection" href="search_component_collection.html"/> + <item name="Collection" href="search_component_collection.html"/> + <item name="Version" href="search_component_version.html"/> </item> <item name="Parser" href="search_parser.html"> <item name="CQL query" href="search_parser_cql.html"/> diff --git a/src/test/java/mtas/solr/MtasSolrTestDistributedSearchConsistency.java b/src/test/java/mtas/solr/MtasSolrTestDistributedSearchConsistency.java index 6259799..1420a1c 100644 --- a/src/test/java/mtas/solr/MtasSolrTestDistributedSearchConsistency.java +++ b/src/test/java/mtas/solr/MtasSolrTestDistributedSearchConsistency.java @@ -11,12 +11,9 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.solr.client.solrj.SolrServerException; -- libgit2 0.22.2