Commit e6f96952a173892b9e298782c9c9f34426ae7c49
1 parent
11ad83a7
adjust order left hit in grouping, changes url maven in documentation
Showing
5 changed files
with
51 additions
and
34 deletions
src/main/java/mtas/codec/util/CodecCollector.java
... | ... | @@ -87,6 +87,8 @@ import org.apache.lucene.util.automaton.RegExp; |
87 | 87 | import org.apache.solr.legacy.LegacyNumericUtils; |
88 | 88 | import org.apache.solr.schema.NumberType; |
89 | 89 | |
90 | +import com.sun.tools.javac.code.Attribute.Array; | |
91 | + | |
90 | 92 | /** |
91 | 93 | * The Class CodecCollector. |
92 | 94 | */ |
... | ... | @@ -1013,11 +1015,11 @@ public class CodecCollector { |
1013 | 1015 | } |
1014 | 1016 | } |
1015 | 1017 | } |
1016 | - MtasSpanQuery hitQuery = createSubQueryFromGroupHit(hit.dataHit, field); | |
1018 | + MtasSpanQuery hitQuery = createSubQueryFromGroupHit(hit.dataHit, false, field); | |
1017 | 1019 | if (hitQuery != null) { |
1018 | 1020 | query = hitQuery; |
1019 | - MtasSpanQuery leftHitQuery = createSubQueryFromGroupHit(hit.dataLeft, field); | |
1020 | - MtasSpanQuery rightHitQuery = createSubQueryFromGroupHit(hit.dataRight, field); | |
1021 | + MtasSpanQuery leftHitQuery = createSubQueryFromGroupHit(hit.dataLeft, true, field); | |
1022 | + MtasSpanQuery rightHitQuery = createSubQueryFromGroupHit(hit.dataRight, false, field); | |
1021 | 1023 | if(leftHitQuery!=null) { |
1022 | 1024 | query = new MtasSpanPrecededByQuery(query, leftHitQuery); |
1023 | 1025 | } |
... | ... | @@ -1029,22 +1031,28 @@ public class CodecCollector { |
1029 | 1031 | } |
1030 | 1032 | } |
1031 | 1033 | |
1032 | - private static MtasSpanQuery createSubQueryFromGroupHit(List<String>[] subHit, | |
1034 | + private static MtasSpanQuery createSubQueryFromGroupHit(List<String>[] subHit, boolean reverse, | |
1033 | 1035 | String field) { |
1034 | 1036 | MtasSpanQuery query = null; |
1035 | 1037 | if (subHit != null && subHit.length > 0) { |
1036 | - List<MtasSpanSequenceItem> items = new ArrayList<>(); | |
1038 | + List<MtasSpanSequenceItem> items = new ArrayList<>(); | |
1039 | + List<String> subHitItem; | |
1037 | 1040 | for (int i = 0; i < subHit.length; i++) { |
1038 | 1041 | MtasSpanQuery item = null; |
1039 | - if (subHit[i].isEmpty()) { | |
1042 | + if(reverse) { | |
1043 | + subHitItem = subHit[(subHit.length - i - 1)]; | |
1044 | + } else { | |
1045 | + subHitItem = subHit[i]; | |
1046 | + } | |
1047 | + if (subHitItem.isEmpty()) { | |
1040 | 1048 | item = new MtasSpanMatchAllQuery(field); |
1041 | - } else if (subHit[i].size() == 1) { | |
1042 | - Term term = new Term(field, subHit[i].get(0)); | |
1049 | + } else if (subHitItem.size() == 1) { | |
1050 | + Term term = new Term(field, subHitItem.get(0)); | |
1043 | 1051 | item = new MtasSpanTermQuery(term); |
1044 | 1052 | } else { |
1045 | - MtasSpanQuery[] subList = new MtasSpanQuery[subHit[i].size()]; | |
1046 | - for (int j = 0; j < subHit[i].size(); j++) { | |
1047 | - Term term = new Term(field, subHit[i].get(j)); | |
1053 | + MtasSpanQuery[] subList = new MtasSpanQuery[subHitItem.size()]; | |
1054 | + for (int j = 0; j < subHitItem.size(); j++) { | |
1055 | + Term term = new Term(field, subHitItem.get(j)); | |
1048 | 1056 | subList[j] = new MtasSpanTermQuery(term); |
1049 | 1057 | } |
1050 | 1058 | item = new MtasSpanAndQuery(subList); |
... | ... |
src/main/java/mtas/codec/util/CodecComponent.java
... | ... | @@ -2555,9 +2555,9 @@ public class CodecComponent { |
2555 | 2555 | } |
2556 | 2556 | } |
2557 | 2557 | // construct keys |
2558 | - keyLeft = dataToString(dataLeft, missingLeft); | |
2559 | - keyHit = dataToString(dataHit, missingHit); | |
2560 | - keyRight = dataToString(dataRight, missingRight); | |
2558 | + keyLeft = dataToString(dataLeft, missingLeft, true); | |
2559 | + keyHit = dataToString(dataHit, missingHit, false); | |
2560 | + keyRight = dataToString(dataRight, missingRight, false); | |
2561 | 2561 | key = KEY_START; |
2562 | 2562 | if (keyLeft != null) { |
2563 | 2563 | key += keyLeft; |
... | ... | @@ -2662,25 +2662,34 @@ public class CodecComponent { |
2662 | 2662 | * @return the string |
2663 | 2663 | * @throws UnsupportedEncodingException the unsupported encoding exception |
2664 | 2664 | */ |
2665 | - private String dataToString(List<String>[] data, Set<String>[] missing) | |
2665 | + private String dataToString(List<String>[] data, Set<String>[] missing, boolean reverse) | |
2666 | 2666 | throws UnsupportedEncodingException { |
2667 | 2667 | StringBuilder text = null; |
2668 | 2668 | Encoder encoder = Base64.getEncoder(); |
2669 | 2669 | String prefix; |
2670 | 2670 | String postfix; |
2671 | + List<String> dataItem; | |
2672 | + Set<String> missingItem; | |
2671 | 2673 | if (data != null && missing != null && data.length == missing.length) { |
2672 | 2674 | for (int i = 0; i < data.length; i++) { |
2675 | + if(reverse) { | |
2676 | + dataItem = data[(data.length-i-1)]; | |
2677 | + missingItem = missing[(data.length-i-1)]; | |
2678 | + } else { | |
2679 | + dataItem = data[i]; | |
2680 | + missingItem = missing[i]; | |
2681 | + } | |
2673 | 2682 | if (i > 0) { |
2674 | 2683 | text.append(","); |
2675 | 2684 | } else { |
2676 | 2685 | text = new StringBuilder(); |
2677 | 2686 | } |
2678 | - for (int j = 0; j < data[i].size(); j++) { | |
2687 | + for (int j = 0; j < dataItem.size(); j++) { | |
2679 | 2688 | if (j > 0) { |
2680 | 2689 | text.append("&"); |
2681 | 2690 | } |
2682 | - prefix = MtasToken.getPrefixFromValue(data[i].get(j)); | |
2683 | - postfix = MtasToken.getPostfixFromValue(data[i].get(j)); | |
2691 | + prefix = MtasToken.getPrefixFromValue(dataItem.get(j)); | |
2692 | + postfix = MtasToken.getPostfixFromValue(dataItem.get(j)); | |
2684 | 2693 | text.append(encoder |
2685 | 2694 | .encodeToString(prefix.getBytes(StandardCharsets.UTF_8))); |
2686 | 2695 | if (!postfix.isEmpty()) { |
... | ... | @@ -2689,11 +2698,11 @@ public class CodecComponent { |
2689 | 2698 | .encodeToString(postfix.getBytes(StandardCharsets.UTF_8))); |
2690 | 2699 | } |
2691 | 2700 | } |
2692 | - if (missing[i] != null) { | |
2693 | - String[] tmpMissing = missing[i] | |
2694 | - .toArray(new String[missing[i].size()]); | |
2701 | + if (missingItem != null) { | |
2702 | + String[] tmpMissing = missingItem | |
2703 | + .toArray(new String[missingItem.size()]); | |
2695 | 2704 | for (int j = 0; j < tmpMissing.length; j++) { |
2696 | - if (j > 0 || !data[i].isEmpty()) { | |
2705 | + if (j > 0 || !dataItem.isEmpty()) { | |
2697 | 2706 | text.append("&"); |
2698 | 2707 | } |
2699 | 2708 | text.append(encoder.encodeToString( |
... | ... |
src/site/markdown/download.md.vm
1 | 1 | #Download |
2 | 2 | |
3 | -#set($metadata = $xml.read("http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/maven-metadata.xml")) | |
3 | +#set($metadata = $xml.read("http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/maven-metadata.xml")) | |
4 | 4 | |
5 | 5 | **Latest release** |
6 | 6 | |
... | ... | @@ -35,10 +35,10 @@ |
35 | 35 | <td><a href='https://github.com/meertensinstituut/mtas/releases/download/v${fullversion}/mtas-${fullversion}.jar'>Binary (jar)</a></td> |
36 | 36 | <td><a href='https://github.com/meertensinstituut/mtas/archive/v${fullversion}.tar.gz'>Source (tgz)</a></td> |
37 | 37 | <td><a href='https://github.com/meertensinstituut/mtas/archive/v${fullversion}.zip'>Source (zip)</a></td> |
38 | - <td><a href='http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}.pom'>pom</a></td> | |
39 | - <td><a href='http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}.jar'>jar</a></td> | |
40 | - <td><a href='http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}-javadoc.jar'>javadoc.jar</a></td> | |
41 | - <td><a href='http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}-sources.jar'>sources.jar</a></td> | |
38 | + <td><a href='http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}.pom'>pom</a></td> | |
39 | + <td><a href='http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}.jar'>jar</a></td> | |
40 | + <td><a href='http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}-javadoc.jar'>javadoc.jar</a></td> | |
41 | + <td><a href='http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}-sources.jar'>sources.jar</a></td> | |
42 | 42 | </tr> |
43 | 43 | </tbody> |
44 | 44 | </table> |
... | ... | @@ -77,14 +77,14 @@ |
77 | 77 | <td><a href='https://github.com/meertensinstituut/mtas/releases/download/v${fullversion}/mtas-${fullversion}.jar'>Binary (jar)</a></td> |
78 | 78 | <td><a href='https://github.com/meertensinstituut/mtas/archive/v${fullversion}.tar.gz'>Source (tgz)</a></td> |
79 | 79 | <td><a href='https://github.com/meertensinstituut/mtas/archive/v${fullversion}.zip'>Source (zip)</a></td> |
80 | - <td><a href='http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}.pom'>pom</a></td> | |
81 | - <td><a href='http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}.jar'>jar</a></td> | |
82 | - <td><a href='http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}-javadoc.jar'>javadoc.jar</a></td> | |
83 | - <td><a href='http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}-sources.jar'>sources.jar</a></td> | |
80 | + <td><a href='http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}.pom'>pom</a></td> | |
81 | + <td><a href='http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}.jar'>jar</a></td> | |
82 | + <td><a href='http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}-javadoc.jar'>javadoc.jar</a></td> | |
83 | + <td><a href='http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/${fullversion}/mtas-${fullversion}-sources.jar'>sources.jar</a></td> | |
84 | 84 | </tr> |
85 | 85 | #end |
86 | 86 | #end |
87 | 87 | </tbody> |
88 | 88 | </table> |
89 | 89 | |
90 | -See also the [Central Repository](http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/) and [GitHub Releases](https://github.com/meertensinstituut/mtas/releases). | |
90 | +See also the [Central Repository](http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/) and [GitHub Releases](https://github.com/meertensinstituut/mtas/releases). | |
... | ... |
src/site/markdown/installation.md.vm
1 | 1 | #Getting started |
2 | -#set($metadata = $xml.read("http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/maven-metadata.xml")) | |
2 | +#set($metadata = $xml.read("http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/maven-metadata.xml")) | |
3 | 3 | #set($version = $metadata.versioning.latest) |
4 | 4 | #set($fullversion = $version.getText()) |
5 | 5 | #set($versionnumbers = $StringUtils.split($fullversion,".")) |
... | ... |
src/site/markdown/installation_solr.md.vm
1 | 1 | #Apache Solr |
2 | -#set($metadata = $xml.read("http://repo1.maven.org/maven2/nl/knaw/meertens/mtas/mtas/maven-metadata.xml")) | |
2 | +#set($metadata = $xml.read("http://central.maven.org/maven2/nl/knaw/meertens/mtas/mtas/maven-metadata.xml")) | |
3 | 3 | #set($version = $metadata.versioning.latest) |
4 | 4 | #set($fullversion = $version.getText()) |
5 | 5 | #set($versionnumbers = $StringUtils.split($fullversion,".")) |
... | ... |