Commit cddc54f257b16c74a10ec2154781e5ba94fa7e74
1 parent
1f67c3af
include version information
Showing
19 changed files
with
314 additions
and
105 deletions
pom.xml
... | ... | @@ -46,6 +46,22 @@ |
46 | 46 | </developer> |
47 | 47 | </developers> |
48 | 48 | <build> |
49 | + <resources> | |
50 | + <resource> | |
51 | + <directory>src/main/resources</directory> | |
52 | + <includes> | |
53 | + <include>project.properties</include> | |
54 | + </includes> | |
55 | + <filtering>true</filtering> | |
56 | + </resource> | |
57 | + <resource> | |
58 | + <directory>src/main/resources</directory> | |
59 | + <excludes> | |
60 | + <exclude>project.properties</exclude> | |
61 | + </excludes> | |
62 | + <filtering>false</filtering> | |
63 | + </resource> | |
64 | + </resources> | |
49 | 65 | <plugins> |
50 | 66 | <plugin> |
51 | 67 | <groupId>org.apache.maven.plugins</groupId> |
... | ... |
src/main/java/mtas/analysis/parser/MtasPennTreebankParser.java
... | ... | @@ -3,11 +3,8 @@ package mtas.analysis.parser; |
3 | 3 | import java.io.IOException; |
4 | 4 | import java.io.Reader; |
5 | 5 | import java.util.ArrayList; |
6 | -import java.util.Arrays; | |
7 | -import java.util.HashMap; | |
8 | 6 | import java.util.HashSet; |
9 | 7 | import java.util.List; |
10 | -import java.util.Map; | |
11 | 8 | import java.util.Objects; |
12 | 9 | import java.util.Set; |
13 | 10 | import java.util.regex.Matcher; |
... | ... |
src/main/java/mtas/codec/util/CodecCollector.java
... | ... | @@ -21,8 +21,6 @@ import java.util.SortedSet; |
21 | 21 | import java.util.TimeZone; |
22 | 22 | import java.util.TreeMap; |
23 | 23 | import java.util.regex.Pattern; |
24 | -import java.util.stream.Collectors; | |
25 | - | |
26 | 24 | import mtas.analysis.token.MtasToken; |
27 | 25 | import mtas.analysis.token.MtasTokenString; |
28 | 26 | import mtas.codec.MtasCodecPostingsFormat; |
... | ... |
src/main/java/mtas/codec/util/CodecComponent.java
... | ... | @@ -34,9 +34,6 @@ import mtas.analysis.token.MtasToken; |
34 | 34 | import mtas.analysis.token.MtasTokenString; |
35 | 35 | import mtas.codec.util.CodecSearchTree.MtasTreeHit; |
36 | 36 | import mtas.codec.util.collector.MtasDataCollector; |
37 | -import mtas.codec.util.distance.LevenshteinDistance; | |
38 | -import mtas.codec.util.distance.MorseDistance; | |
39 | -import mtas.codec.util.distance.DamerauLevenshteinDistance; | |
40 | 37 | import mtas.codec.util.distance.Distance; |
41 | 38 | import mtas.parser.function.MtasFunctionParser; |
42 | 39 | import mtas.parser.function.ParseException; |
... | ... | @@ -50,6 +47,7 @@ import org.apache.lucene.util.BytesRef; |
50 | 47 | import org.noggit.JSONParser; |
51 | 48 | import org.noggit.ObjectBuilder; |
52 | 49 | |
50 | +// TODO: Auto-generated Javadoc | |
53 | 51 | /** |
54 | 52 | * The Class CodecComponent. |
55 | 53 | */ |
... | ... | @@ -67,7 +65,11 @@ public class CodecComponent { |
67 | 65 | */ |
68 | 66 | public static class ComponentFields { |
69 | 67 | |
68 | + /** The status. */ | |
70 | 69 | public ComponentStatus status; |
70 | + | |
71 | + /** The version. */ | |
72 | + public ComponentVersion version; | |
71 | 73 | |
72 | 74 | /** The list. */ |
73 | 75 | public Map<String, ComponentField> list; |
... | ... | @@ -113,6 +115,9 @@ public class CodecComponent { |
113 | 115 | |
114 | 116 | /** The do status. */ |
115 | 117 | public boolean doStatus; |
118 | + | |
119 | + /** The do version. */ | |
120 | + public boolean doVersion; | |
116 | 121 | |
117 | 122 | /** |
118 | 123 | * Instantiates a new component fields. |
... | ... | @@ -134,6 +139,7 @@ public class CodecComponent { |
134 | 139 | doFacet = false; |
135 | 140 | doCollection = false; |
136 | 141 | doStatus = false; |
142 | + doVersion = false; | |
137 | 143 | } |
138 | 144 | } |
139 | 145 | |
... | ... | @@ -1338,56 +1344,32 @@ public class CodecComponent { |
1338 | 1344 | /** |
1339 | 1345 | * Instantiates a new component term vector. |
1340 | 1346 | * |
1341 | - * @param key | |
1342 | - * the key | |
1343 | - * @param prefix | |
1344 | - * the prefix | |
1345 | - * @param distanceKey | |
1346 | - * the distance key | |
1347 | - * @param distanceType | |
1348 | - * the distance type | |
1349 | - * @param distanceBase | |
1350 | - * the distance base | |
1351 | - * @param distanceParameter | |
1352 | - * the distance parameter | |
1353 | - * @param distanceMaximum | |
1354 | - * the distance maximum | |
1355 | - * @param regexp | |
1356 | - * the regexp | |
1357 | - * @param full | |
1358 | - * the full | |
1359 | - * @param type | |
1360 | - * the type | |
1361 | - * @param sortType | |
1362 | - * the sort type | |
1363 | - * @param sortDirection | |
1364 | - * the sort direction | |
1365 | - * @param startValue | |
1366 | - * the start value | |
1367 | - * @param number | |
1368 | - * the number | |
1369 | - * @param functionKey | |
1370 | - * the function key | |
1371 | - * @param functionExpression | |
1372 | - * the function expression | |
1373 | - * @param functionType | |
1374 | - * the function type | |
1375 | - * @param boundary | |
1376 | - * the boundary | |
1377 | - * @param list | |
1378 | - * the list | |
1379 | - * @param listRegexp | |
1380 | - * the list regexp | |
1381 | - * @param ignoreRegexp | |
1382 | - * the ignore regexp | |
1383 | - * @param ignoreList | |
1384 | - * the ignore list | |
1385 | - * @param ignoreListRegexp | |
1386 | - * the ignore list regexp | |
1387 | - * @throws IOException | |
1388 | - * Signals that an I/O exception has occurred. | |
1389 | - * @throws ParseException | |
1390 | - * the parse exception | |
1347 | + * @param key the key | |
1348 | + * @param prefix the prefix | |
1349 | + * @param distanceKey the distance key | |
1350 | + * @param distanceType the distance type | |
1351 | + * @param distanceBase the distance base | |
1352 | + * @param distanceParameter the distance parameter | |
1353 | + * @param distanceMinimum the distance minimum | |
1354 | + * @param distanceMaximum the distance maximum | |
1355 | + * @param regexp the regexp | |
1356 | + * @param full the full | |
1357 | + * @param type the type | |
1358 | + * @param sortType the sort type | |
1359 | + * @param sortDirection the sort direction | |
1360 | + * @param startValue the start value | |
1361 | + * @param number the number | |
1362 | + * @param functionKey the function key | |
1363 | + * @param functionExpression the function expression | |
1364 | + * @param functionType the function type | |
1365 | + * @param boundary the boundary | |
1366 | + * @param list the list | |
1367 | + * @param listRegexp the list regexp | |
1368 | + * @param ignoreRegexp the ignore regexp | |
1369 | + * @param ignoreList the ignore list | |
1370 | + * @param ignoreListRegexp the ignore list regexp | |
1371 | + * @throws IOException Signals that an I/O exception has occurred. | |
1372 | + * @throws ParseException the parse exception | |
1391 | 1373 | */ |
1392 | 1374 | @SuppressWarnings({ "unchecked", "rawtypes" }) |
1393 | 1375 | public ComponentTermVector(String key, String prefix, String[] distanceKey, |
... | ... | @@ -1571,15 +1553,39 @@ public class CodecComponent { |
1571 | 1553 | */ |
1572 | 1554 | public static class ComponentStatus implements BasicComponent { |
1573 | 1555 | |
1556 | + /** The handler. */ | |
1574 | 1557 | public String handler; |
1558 | + | |
1559 | + /** The name. */ | |
1575 | 1560 | public String name; |
1561 | + | |
1562 | + /** The key. */ | |
1576 | 1563 | public String key; |
1564 | + | |
1565 | + /** The number of documents. */ | |
1577 | 1566 | public Integer numberOfDocuments; |
1567 | + | |
1568 | + /** The number of segments. */ | |
1578 | 1569 | public Integer numberOfSegments; |
1570 | + | |
1571 | + /** The get mtas handler. */ | |
1579 | 1572 | public boolean getMtasHandler; |
1573 | + | |
1574 | + /** The get number of documents. */ | |
1580 | 1575 | public boolean getNumberOfDocuments; |
1576 | + | |
1577 | + /** The get number of segments. */ | |
1581 | 1578 | public boolean getNumberOfSegments; |
1582 | 1579 | |
1580 | + /** | |
1581 | + * Instantiates a new component status. | |
1582 | + * | |
1583 | + * @param name the name | |
1584 | + * @param key the key | |
1585 | + * @param getMtasHandler the get mtas handler | |
1586 | + * @param getNumberOfDocuments the get number of documents | |
1587 | + * @param getNumberOfSegments the get number of segments | |
1588 | + */ | |
1583 | 1589 | public ComponentStatus(String name, String key, boolean getMtasHandler, |
1584 | 1590 | boolean getNumberOfDocuments, boolean getNumberOfSegments) { |
1585 | 1591 | this.name = Objects.requireNonNull(name, "no name"); |
... | ... | @@ -1593,7 +1599,17 @@ public class CodecComponent { |
1593 | 1599 | } |
1594 | 1600 | |
1595 | 1601 | } |
1602 | + | |
1603 | + /** | |
1604 | + * The Class ComponentVersion. | |
1605 | + */ | |
1606 | + public static class ComponentVersion implements BasicComponent { | |
1607 | + public ComponentVersion() { | |
1608 | + | |
1609 | + } | |
1610 | + } | |
1596 | 1611 | |
1612 | + | |
1597 | 1613 | /** |
1598 | 1614 | * The Interface ComponentStats. |
1599 | 1615 | */ |
... | ... | @@ -1926,6 +1942,7 @@ public class CodecComponent { |
1926 | 1942 | /** The version. */ |
1927 | 1943 | public String version; |
1928 | 1944 | |
1945 | + /** The original version. */ | |
1929 | 1946 | public String originalVersion; |
1930 | 1947 | |
1931 | 1948 | /** The id. */ |
... | ... | @@ -2025,12 +2042,10 @@ public class CodecComponent { |
2025 | 2042 | /** |
2026 | 2043 | * Sets the post variables. |
2027 | 2044 | * |
2028 | - * @param id | |
2029 | - * the id | |
2030 | - * @param values | |
2031 | - * the values | |
2032 | - * @throws IOException | |
2033 | - * Signals that an I/O exception has occurred. | |
2045 | + * @param id the id | |
2046 | + * @param values the values | |
2047 | + * @param originalVersion the original version | |
2048 | + * @throws IOException Signals that an I/O exception has occurred. | |
2034 | 2049 | */ |
2035 | 2050 | public void setPostVariables(String id, HashSet<String> values, String originalVersion) |
2036 | 2051 | throws IOException { |
... | ... | @@ -2169,6 +2184,12 @@ public class CodecComponent { |
2169 | 2184 | return action; |
2170 | 2185 | } |
2171 | 2186 | |
2187 | + /** | |
2188 | + * Original version. | |
2189 | + * | |
2190 | + * @return the string | |
2191 | + * @throws IOException Signals that an I/O exception has occurred. | |
2192 | + */ | |
2172 | 2193 | public String originalVersion() throws IOException { |
2173 | 2194 | if(action.equals(ACTION_POST)) { |
2174 | 2195 | return originalVersion; |
... | ... | @@ -2282,6 +2303,7 @@ public class CodecComponent { |
2282 | 2303 | /** The prefix. */ |
2283 | 2304 | public String prefix; |
2284 | 2305 | |
2306 | + /** The minimum. */ | |
2285 | 2307 | public Double minimum; |
2286 | 2308 | |
2287 | 2309 | /** The maximum. */ |
... | ... | @@ -2305,18 +2327,13 @@ public class CodecComponent { |
2305 | 2327 | /** |
2306 | 2328 | * Instantiates a new sub component distance. |
2307 | 2329 | * |
2308 | - * @param key | |
2309 | - * the key | |
2310 | - * @param type | |
2311 | - * the type | |
2312 | - * @param prefix | |
2313 | - * the prefix | |
2314 | - * @param base | |
2315 | - * the base | |
2316 | - * @param parameters | |
2317 | - * the parameters | |
2318 | - * @param maximum | |
2319 | - * the maximum | |
2330 | + * @param key the key | |
2331 | + * @param type the type | |
2332 | + * @param prefix the prefix | |
2333 | + * @param base the base | |
2334 | + * @param parameters the parameters | |
2335 | + * @param minimum the minimum | |
2336 | + * @param maximum the maximum | |
2320 | 2337 | */ |
2321 | 2338 | public SubComponentDistance(String key, String type, String prefix, |
2322 | 2339 | String base, Map<String, String> parameters, String minimum, String maximum) { |
... | ... | @@ -2361,6 +2378,12 @@ public class CodecComponent { |
2361 | 2378 | return distance; |
2362 | 2379 | } |
2363 | 2380 | |
2381 | + /** | |
2382 | + * Creates the class name. | |
2383 | + * | |
2384 | + * @param type the type | |
2385 | + * @return the string | |
2386 | + */ | |
2364 | 2387 | private String createClassName(String type) { |
2365 | 2388 | final char DASH = '-'; |
2366 | 2389 | Objects.requireNonNull(type, "Type is obligatory"); |
... | ... |
src/main/java/mtas/solr/handler/component/MtasSolrSearchComponent.java
... | ... | @@ -38,6 +38,8 @@ import mtas.solr.handler.component.util.MtasSolrComponentPrefix; |
38 | 38 | import mtas.solr.handler.component.util.MtasSolrComponentStats; |
39 | 39 | import mtas.solr.handler.component.util.MtasSolrComponentStatus; |
40 | 40 | import mtas.solr.handler.component.util.MtasSolrComponentTermvector; |
41 | +import mtas.solr.handler.component.util.MtasSolrComponentVersion; | |
42 | + | |
41 | 43 | import org.apache.commons.logging.Log; |
42 | 44 | import org.apache.commons.logging.LogFactory; |
43 | 45 | import org.apache.solr.common.params.CommonParams; |
... | ... | @@ -156,6 +158,8 @@ public class MtasSolrSearchComponent extends SearchComponent { |
156 | 158 | |
157 | 159 | /** The search status. */ |
158 | 160 | private MtasSolrComponentStatus searchStatus; |
161 | + | |
162 | + private MtasSolrComponentVersion searchVersion; | |
159 | 163 | |
160 | 164 | /** The collection cache. */ |
161 | 165 | private MtasSolrCollectionCache collectionCache = null; |
... | ... | @@ -178,6 +182,7 @@ public class MtasSolrSearchComponent extends SearchComponent { |
178 | 182 | super.init(args); |
179 | 183 | // init components |
180 | 184 | searchStatus = new MtasSolrComponentStatus(this); |
185 | + searchVersion = new MtasSolrComponentVersion(this); | |
181 | 186 | searchDocument = new MtasSolrComponentDocument(this); |
182 | 187 | searchKwic = new MtasSolrComponentKwic(this); |
183 | 188 | searchList = new MtasSolrComponentList(this); |
... | ... | @@ -261,6 +266,11 @@ public class MtasSolrSearchComponent extends SearchComponent { |
261 | 266 | mtasSolrResultMerge = new MtasSolrResultMerge(); |
262 | 267 | // prepare components |
263 | 268 | ComponentFields mtasFields = new ComponentFields(); |
269 | + // get settings version | |
270 | + if (rb.req.getParams() | |
271 | + .getBool(MtasSolrComponentVersion.PARAM_MTAS_VERSION, false)) { | |
272 | + searchVersion.prepare(rb, mtasFields); | |
273 | + } | |
264 | 274 | // get settings status |
265 | 275 | if (rb.req.getParams() |
266 | 276 | .getBool(MtasSolrComponentStatus.PARAM_MTAS_STATUS, false)) { |
... | ... | @@ -357,7 +367,7 @@ public class MtasSolrSearchComponent extends SearchComponent { |
357 | 367 | if (mtasFields.doStats || mtasFields.doDocument || mtasFields.doKwic |
358 | 368 | || mtasFields.doList || mtasFields.doGroup || mtasFields.doFacet |
359 | 369 | || mtasFields.doCollection || mtasFields.doTermVector |
360 | - || mtasFields.doPrefix || mtasFields.doStatus) { | |
370 | + || mtasFields.doPrefix || mtasFields.doStatus || mtasFields.doVersion) { | |
361 | 371 | SolrIndexSearcher searcher = rb.req.getSearcher(); |
362 | 372 | ArrayList<Integer> docSetList = null; |
363 | 373 | ArrayList<Integer> docListList = null; |
... | ... | @@ -396,6 +406,10 @@ public class MtasSolrSearchComponent extends SearchComponent { |
396 | 406 | collection); |
397 | 407 | } |
398 | 408 | NamedList<Object> mtasResponse = new SimpleOrderedMap<>(); |
409 | + if (mtasFields.doVersion) { | |
410 | + SimpleOrderedMap<Object> versionResponse = searchVersion.create(mtasFields.version, false); | |
411 | + mtasResponse.add(MtasSolrComponentVersion.NAME, versionResponse); | |
412 | + } | |
399 | 413 | if (mtasFields.doStatus) { |
400 | 414 | // add to response |
401 | 415 | SimpleOrderedMap<Object> statusResponse = searchStatus |
... | ... |
src/main/java/mtas/solr/handler/component/util/MtasSolrComponent.java
... | ... | @@ -9,7 +9,6 @@ import org.apache.solr.handler.component.ShardRequest; |
9 | 9 | |
10 | 10 | import mtas.codec.util.CodecComponent.BasicComponent; |
11 | 11 | import mtas.codec.util.CodecComponent.ComponentFields; |
12 | -import mtas.solr.handler.MtasRequestHandler; | |
13 | 12 | |
14 | 13 | /** |
15 | 14 | * The Interface MtasSolrComponent. |
... | ... |
src/main/java/mtas/solr/handler/component/util/MtasSolrComponentFacet.java
... | ... | @@ -8,7 +8,6 @@ import java.util.Set; |
8 | 8 | |
9 | 9 | import org.apache.commons.logging.Log; |
10 | 10 | import org.apache.commons.logging.LogFactory; |
11 | -import org.apache.lucene.index.DocValuesType; | |
12 | 11 | import org.apache.solr.common.util.NamedList; |
13 | 12 | import org.apache.solr.common.util.SimpleOrderedMap; |
14 | 13 | import org.apache.solr.handler.component.ResponseBuilder; |
... | ... |
src/main/java/mtas/solr/handler/component/util/MtasSolrComponentStatus.java
1 | 1 | package mtas.solr.handler.component.util; |
2 | 2 | |
3 | 3 | import java.io.IOException; |
4 | -import java.util.Map.Entry; | |
5 | - | |
6 | 4 | import org.apache.commons.logging.Log; |
7 | 5 | import org.apache.commons.logging.LogFactory; |
8 | -import org.apache.solr.common.params.ShardParams; | |
9 | 6 | import org.apache.solr.common.util.SimpleOrderedMap; |
10 | -import org.apache.solr.core.SolrInfoBean; | |
11 | 7 | import org.apache.solr.handler.component.ResponseBuilder; |
12 | 8 | import org.apache.solr.handler.component.SearchComponent; |
13 | 9 | import org.apache.solr.handler.component.ShardRequest; |
14 | 10 | |
15 | -import mtas.codec.util.Status; | |
16 | 11 | import mtas.codec.util.CodecComponent.ComponentFields; |
17 | 12 | import mtas.codec.util.CodecComponent.ComponentStatus; |
18 | -import mtas.solr.handler.MtasRequestHandler; | |
19 | 13 | import mtas.solr.handler.MtasRequestHandler.ShardInformation; |
20 | 14 | import mtas.solr.handler.component.MtasSolrSearchComponent; |
21 | 15 | |
... | ... |
src/main/java/mtas/solr/handler/component/util/MtasSolrComponentTermvector.java
src/main/java/mtas/solr/handler/component/util/MtasSolrComponentVersion.java
0 → 100644
1 | +package mtas.solr.handler.component.util; | |
2 | + | |
3 | +import java.io.IOException; | |
4 | +import java.io.InputStream; | |
5 | +import java.util.Properties; | |
6 | + | |
7 | +import org.apache.commons.logging.Log; | |
8 | +import org.apache.commons.logging.LogFactory; | |
9 | +import org.apache.solr.common.util.SimpleOrderedMap; | |
10 | +import org.apache.solr.handler.component.ResponseBuilder; | |
11 | +import org.apache.solr.handler.component.SearchComponent; | |
12 | +import org.apache.solr.handler.component.ShardRequest; | |
13 | + | |
14 | +import mtas.codec.util.CodecComponent.ComponentFields; | |
15 | +import mtas.codec.util.CodecComponent.ComponentVersion; | |
16 | +import mtas.solr.handler.component.MtasSolrSearchComponent; | |
17 | + | |
18 | +// TODO: Auto-generated Javadoc | |
19 | +/** | |
20 | + * The Class MtasSolrComponentStatus. | |
21 | + */ | |
22 | +public class MtasSolrComponentVersion | |
23 | + implements MtasSolrComponent<ComponentVersion> { | |
24 | + | |
25 | + /** The Constant log. */ | |
26 | + private static final Log log = LogFactory | |
27 | + .getLog(MtasSolrComponentVersion.class); | |
28 | + | |
29 | + /** The search component. */ | |
30 | + MtasSolrSearchComponent searchComponent; | |
31 | + | |
32 | + String propertyVersion = null; | |
33 | + | |
34 | + String propertyArtifactId = null; | |
35 | + | |
36 | + String propertyGroupId = null; | |
37 | + | |
38 | + String propertyTimestamp = null; | |
39 | + | |
40 | + /** The Constant NAME. */ | |
41 | + public static final String NAME = "version"; | |
42 | + | |
43 | + /** The Constant PARAM_MTAS_VERSION. */ | |
44 | + public static final String PARAM_MTAS_VERSION = MtasSolrSearchComponent.PARAM_MTAS | |
45 | + + "." + NAME; | |
46 | + | |
47 | + public static final String NAME_MTAS_VERSION_VERSION = "version"; | |
48 | + | |
49 | + public static final String NAME_MTAS_VERSION_GROUPID = "groupId"; | |
50 | + | |
51 | + public static final String NAME_MTAS_VERSION_ARTIFACTID = "artifactId"; | |
52 | + | |
53 | + public static final String NAME_MTAS_VERSION_TIMESTAMP = "timestamp"; | |
54 | + | |
55 | + /** | |
56 | + * Instantiates a new mtas solr component status. | |
57 | + * | |
58 | + * @param searchComponent | |
59 | + * the search component | |
60 | + */ | |
61 | + public MtasSolrComponentVersion(MtasSolrSearchComponent searchComponent) { | |
62 | + this.searchComponent = searchComponent; | |
63 | + String resourceName = "project.properties"; // could also be a constant | |
64 | + ClassLoader loader = Thread.currentThread().getContextClassLoader(); | |
65 | + Properties props = new Properties(); | |
66 | + try(InputStream resourceStream = loader.getResourceAsStream(resourceName)) { | |
67 | + props.load(resourceStream); | |
68 | + propertyVersion = props.getProperty(NAME_MTAS_VERSION_VERSION); | |
69 | + propertyArtifactId = props.getProperty(NAME_MTAS_VERSION_ARTIFACTID); | |
70 | + propertyGroupId = props.getProperty(NAME_MTAS_VERSION_GROUPID); | |
71 | + propertyTimestamp = props.getProperty(NAME_MTAS_VERSION_TIMESTAMP); | |
72 | + } catch (IOException e) { | |
73 | + log.info("couldn't read project.properties: "+e.getMessage()); | |
74 | + } | |
75 | + } | |
76 | + | |
77 | + /* | |
78 | + * (non-Javadoc) | |
79 | + * | |
80 | + * @see | |
81 | + * mtas.solr.handler.component.util.MtasSolrComponent#prepare(org.apache.solr. | |
82 | + * handler.component.ResponseBuilder, | |
83 | + * mtas.codec.util.CodecComponent.ComponentFields) | |
84 | + */ | |
85 | + @Override | |
86 | + public void prepare(ResponseBuilder rb, ComponentFields mtasFields) | |
87 | + throws IOException { | |
88 | + mtasFields.doVersion = true; | |
89 | + mtasFields.version = new ComponentVersion(); | |
90 | + } | |
91 | + | |
92 | + /* | |
93 | + * (non-Javadoc) | |
94 | + * | |
95 | + * @see | |
96 | + * mtas.solr.handler.component.util.MtasSolrComponent#create(mtas.codec.util. | |
97 | + * CodecComponent.BasicComponent, java.lang.Boolean) | |
98 | + */ | |
99 | + @Override | |
100 | + public SimpleOrderedMap<Object> create(ComponentVersion version, Boolean encode) | |
101 | + throws IOException { | |
102 | + SimpleOrderedMap<Object> mtasVersionResponse = new SimpleOrderedMap<>(); | |
103 | + mtasVersionResponse.add(NAME_MTAS_VERSION_GROUPID, propertyGroupId); | |
104 | + mtasVersionResponse.add(NAME_MTAS_VERSION_ARTIFACTID, propertyArtifactId); | |
105 | + mtasVersionResponse.add(NAME_MTAS_VERSION_VERSION, propertyVersion); | |
106 | + mtasVersionResponse.add(NAME_MTAS_VERSION_TIMESTAMP, propertyTimestamp); | |
107 | + return mtasVersionResponse; | |
108 | + | |
109 | + } | |
110 | + | |
111 | + /* | |
112 | + * (non-Javadoc) | |
113 | + * | |
114 | + * @see | |
115 | + * mtas.solr.handler.component.util.MtasSolrComponent#modifyRequest(org.apache | |
116 | + * .solr.handler.component.ResponseBuilder, | |
117 | + * org.apache.solr.handler.component.SearchComponent, | |
118 | + * org.apache.solr.handler.component.ShardRequest) | |
119 | + */ | |
120 | + @Override | |
121 | + public void modifyRequest(ResponseBuilder rb, SearchComponent who, | |
122 | + ShardRequest sreq) { | |
123 | + sreq.params.remove(PARAM_MTAS_VERSION); | |
124 | + } | |
125 | + | |
126 | + /* | |
127 | + * (non-Javadoc) | |
128 | + * | |
129 | + * @see | |
130 | + * mtas.solr.handler.component.util.MtasSolrComponent#finishStage(org.apache. | |
131 | + * solr.handler.component.ResponseBuilder) | |
132 | + */ | |
133 | + @Override | |
134 | + public void finishStage(ResponseBuilder rb) { | |
135 | + // TODO Auto-generated method stub | |
136 | + | |
137 | + } | |
138 | + | |
139 | + /* | |
140 | + * (non-Javadoc) | |
141 | + * | |
142 | + * @see | |
143 | + * mtas.solr.handler.component.util.MtasSolrComponent#distributedProcess(org. | |
144 | + * apache.solr.handler.component.ResponseBuilder, | |
145 | + * mtas.codec.util.CodecComponent.ComponentFields) | |
146 | + */ | |
147 | + @Override | |
148 | + public void distributedProcess(ResponseBuilder rb, ComponentFields mtasFields) | |
149 | + throws IOException { | |
150 | + // TODO Auto-generated method stub | |
151 | + | |
152 | + } | |
153 | + | |
154 | +} | |
... | ... |
src/main/java/mtas/solr/handler/component/util/MtasSolrResultUtil.java
src/main/java/mtas/solr/handler/util/MtasSolrStatus.java
src/main/java/mtas/solr/search/MtasJoinQParser.java
src/main/java/mtas/solr/search/MtasSolrJoinQParserPlugin.java
1 | 1 | package mtas.solr.search; |
2 | 2 | |
3 | -import java.io.IOException; | |
4 | - | |
5 | 3 | import org.apache.solr.common.params.SolrParams; |
6 | 4 | import org.apache.solr.common.util.NamedList; |
7 | -import org.apache.solr.core.CoreContainer; | |
8 | -import org.apache.solr.core.PluginBag.PluginHolder; | |
9 | -import org.apache.solr.handler.component.SearchComponent; | |
10 | 5 | import org.apache.solr.request.SolrQueryRequest; |
11 | 6 | import org.apache.solr.search.QParser; |
12 | 7 | import org.apache.solr.search.QParserPlugin; |
13 | 8 | |
14 | -import mtas.solr.handler.component.MtasSolrSearchComponent; | |
15 | - | |
16 | 9 | /** |
17 | 10 | * The Class MtasSolrJoinQParserPlugin. |
18 | 11 | */ |
... | ... |
src/main/java/mtas/solr/update/processor/MtasUpdateRequestProcessorFactory.java
... | ... | @@ -7,12 +7,9 @@ import java.lang.reflect.Constructor; |
7 | 7 | import java.lang.reflect.InvocationTargetException; |
8 | 8 | import java.util.ArrayList; |
9 | 9 | import java.util.HashMap; |
10 | -import java.util.HashSet; | |
11 | 10 | import java.util.Iterator; |
12 | 11 | import java.util.Map; |
13 | 12 | import java.util.Map.Entry; |
14 | -import java.util.Set; | |
15 | - | |
16 | 13 | import org.apache.commons.logging.Log; |
17 | 14 | import org.apache.commons.logging.LogFactory; |
18 | 15 | import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; |
... | ... |
src/main/resources/project.properties
0 → 100644
src/site/markdown/search_component_version.md
0 → 100644
1 | +#Version | |
2 | + | |
3 | +Mtas provides a method to display information about `artifactId`, `groupId`, `version` and `timestamp` from the build. | |
4 | + | |
5 | +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. | |
6 | + | |
7 | +| Parameter | Value | Obligatory | | |
8 | +|-----------------------|--------|-------------| | |
9 | +| mtas.version | true | yes | | |
10 | + | |
11 | +--- | |
12 | + | |
13 | +**Example** | |
14 | +Inlcude Mtas build information | |
15 | + | |
16 | + | |
17 | +**Request and response** | |
18 | +`q=*:*&rows=0&wt=json&mtas=true&mtas.version=true` | |
19 | + | |
20 | +```json | |
21 | +"mtas":{ | |
22 | + "version":{ | |
23 | + "groupId":"org.textexploration.mtas", | |
24 | + "artifactId":"mtas", | |
25 | + "version":"7.3.1.1-SNAPSHOT", | |
26 | + "timestamp":"2018-06-10 12:25"}} | |
27 | +``` | |
28 | + | |
29 | + | |
... | ... |
src/site/site.xml
... | ... | @@ -52,7 +52,8 @@ |
52 | 52 | <item name="Facet" href="search_component_facet.html"/> |
53 | 53 | <item name="Group" href="search_component_group.html"/> |
54 | 54 | <item name="Prefix" href="search_component_prefix.html"/> |
55 | - <item name="Collection" href="search_component_collection.html"/> | |
55 | + <item name="Collection" href="search_component_collection.html"/> | |
56 | + <item name="Version" href="search_component_version.html"/> | |
56 | 57 | </item> |
57 | 58 | <item name="Parser" href="search_parser.html"> |
58 | 59 | <item name="CQL query" href="search_parser_cql.html"/> |
... | ... |
src/test/java/mtas/solr/MtasSolrTestDistributedSearchConsistency.java
... | ... | @@ -11,12 +11,9 @@ import java.nio.file.Paths; |
11 | 11 | import java.util.ArrayList; |
12 | 12 | import java.util.Arrays; |
13 | 13 | import java.util.HashMap; |
14 | -import java.util.HashSet; | |
15 | 14 | import java.util.List; |
16 | 15 | import java.util.Map; |
17 | 16 | import java.util.Map.Entry; |
18 | -import java.util.Set; | |
19 | - | |
20 | 17 | import org.apache.commons.logging.Log; |
21 | 18 | import org.apache.commons.logging.LogFactory; |
22 | 19 | import org.apache.solr.client.solrj.SolrServerException; |
... | ... |