Skip to content

Commit 126af86

Browse files
committed
Different little bugs
1 parent 3be1c1a commit 126af86

8 files changed

Lines changed: 17 additions & 17 deletions

File tree

analysis/src/resources/com/github/oeuvres/alix/xml/alix.xsl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,10 @@
416416
<xsl:call-template name="toclocal"/>
417417
</alix:field>
418418
<alix:field name="content" type="text">
419-
<article class="chapter">
419+
<xsl:variable name="hourglass">
420+
<xsl:if test="/*/@cert and /*/@cert = 'low'"> hourglass</xsl:if>
421+
</xsl:variable>
422+
<article class="chapter{$hourglass}">
420423
<xsl:choose>
421424
<xsl:when test="descendant::*[key('split', generate-id())]">
422425
<!-- take content before sections -->

common/src/java/com/github/oeuvres/alix/lucene/spans/CoocListener.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ public CoocListener(
117117
if (left < 0 || right < 0) {
118118
throw new IllegalArgumentException("left and right must be >= 0; got left=" + left + ", right=" + right);
119119
}
120-
if (left == 0 && right == 0) {
121-
throw new IllegalArgumentException("left and right cannot both be 0");
122-
}
123120
this.left = left;
124121
this.right = right;
125122
this.windowMask = new BitSet(fieldStats.maxWidth());

common/src/java/com/github/oeuvres/alix/lucene/spans/SpanQueryParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ else if (!orClauses.isEmpty()) {
113113
if (clauses.size() == 1) {
114114
return clauses.get(0);
115115
}
116-
return new SpanNearQuery(clauses.toArray(new SpanQuery[0]), slop, true);
116+
return new SpanNearQuery(clauses.toArray(new SpanQuery[0]), slop, false);
117117
}
118118

119119
}

test/src/test/java/com/github/oeuvres/alix/lucene/analysis/LemmaFilterTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ public class LemmaFilterTest {
2828
void setUp() {
2929
lex = new LemmaLexicon(64);
3030

31-
// -------------------------
32-
// POS-dependent homographs
33-
// -------------------------
3431
// "saw": noun lemma == surface; verb lemma == "see"
3532
put(lex, "saw", POS_NOUN, "saw");
3633
put(lex, "saw", POS_VERB, "see");
@@ -51,9 +48,7 @@ void setUp() {
5148
put(lex, "left", POS_ADJ, "left");
5249
put(lex, "left", POS_VERB, "leave");
5350

54-
// -------------------------
5551
// POS-agnostic (DEFAULT_POS) entries
56-
// -------------------------
5752
put(lex, "children", LemmaLexicon.ANY_POS, "child");
5853
put(lex, "mice", LemmaLexicon.ANY_POS, "mouse");
5954

util/src/java/com/github/oeuvres/alix/util/Markup.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ private Markup()
4747
public static int leftBoundary(final String xml, int offset, final int words, final int chars)
4848
{
4949
if (offset < 0) return 0;
50+
if (words == 0 || chars == 0) return offset + 1;
5051
int wc = 0;
5152
int cc = 0;
5253
boolean inTag = false; // scanning backward: '>' opens a tag, '<' closes it
@@ -122,6 +123,7 @@ public static int leftBoundary(final String xml, int offset, final int words, fi
122123
*/
123124
public static int rightBoundary(final String xml, int offset, final int words, final int chars)
124125
{
126+
if (words == 0 || chars == 0) return offset;
125127
final int length = xml.length();
126128
int wc = 0;
127129
int cc = 0;

web/src/main/java/com/github/oeuvres/alix/web/OpResults.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,15 @@ protected void html(LuceneIndex index, HttpServletRequest request, HttpServletRe
225225
final String docline = pars.getString(DOCLINE, index.docline());
226226
final int docs = pars.getInt(DOCS, DOCS_RANGE, DOCS_DEFAULT, DOCS);
227227
final int spans = pars.getInt(SPANS, SPANS_RANGE, SPANS_DEFAULT, SPANS);
228+
// transmit the slop parameter explicitly, cookie maybe not transmitted in some context
229+
final int slop = pars.getInt(SLOP, SLOP_RANGE, SLOP_DEFAULT, SLOP);
228230

229231
HtmlResults results = new HtmlResults(writer, index.reader().storedFields(), content)
230232
.doclineFieldName(docline)
231233
.docLimit(docs)
232234
.spanLimit(spans)
233235
.ctx(ctx)
234-
.hrefSearch("?" + pars.queryString(CTX, F, Q, SLOP));
236+
.hrefSearch("?" + pars.queryString(CTX, F, Q) + "&amp;slop=" + slop);
235237
final int from = pars.getInt(FROM, 0);
236238

237239
// final String q = pars.getString(Q, null);
@@ -268,7 +270,7 @@ protected void html(LuceneIndex index, HttpServletRequest request, HttpServletRe
268270
.append("\" name=\"next-results\" href=\"")
269271
.append("?")
270272
.append(pars.queryString(DOCLINE, END, F, ROWS, START))
271-
.append("&amp;from=" + docId)
273+
.append("&amp;from=" + docId )
272274
.append("\">…</a></p>\n");
273275
;
274276
}

web/src/main/java/com/github/oeuvres/alix/web/OpSuggest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import com.github.oeuvres.alix.lucene.terms.TopTerms;
1919
import com.github.oeuvres.alix.lucene.terms.TopTerms.TermEntry;
2020
import com.github.oeuvres.alix.lucene.util.BitsCollectorManager;
21-
import com.github.oeuvres.alix.web.Op.OpMeta;
2221
import com.github.oeuvres.alix.web.util.HttpPars;
2322

2423
import static com.github.oeuvres.alix.web.Pars.*;
@@ -67,14 +66,17 @@ else if (spanQuery == null) {
6766
}
6867
// coocs, with or without doc filter TODO
6968
else {
69+
/*
7070
final int ctx = pars.getInt(CTX, CTX_RANGE, CTX_DEFAULT, CTX);
7171
final int left = pars.getInt(CTX_LEFT, CTX_RANGE, ctx, CTX_LEFT);
7272
final int right = pars.getInt(CTX_RIGHT, CTX_RANGE, ctx, CTX_RIGHT);
73+
*/
74+
final int slop = pars.getInt(SLOP, SLOP_RANGE, SLOP_DEFAULT, SLOP);
7375
final CoocListener listener = new CoocListener(
7476
textFluc.fieldStats(),
7577
textFluc.termRail(),
76-
left,
77-
right);
78+
slop,
79+
slop);
7880
final SpanWalker walker = new SpanWalker(
7981
index.searcher(),
8082
textFluc.termLexicon(),
@@ -109,7 +111,7 @@ protected void json(
109111
if (topTerms != null) {
110112
String textField = pars.getString(F, index.content());
111113
final FlucText textFluc = index.flucText(textField);
112-
final String infix = pars.getString(INFIX, "");
114+
final String infix = pars.getString(INFIX, "").replace("(", "").replace(")", "");;
113115
final int topK = pars.getInt(TERMS, TERMS_RANGE, TERMS_DEFAULT, TERMS);
114116
meta.put("infix", infix);
115117
meta.put("limit", topK);

web/src/main/java/com/github/oeuvres/alix/web/OpTerms.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.github.oeuvres.alix.lucene.terms.PartScorer;
2323
import com.github.oeuvres.alix.lucene.terms.Partition;
2424
import com.github.oeuvres.alix.lucene.terms.PartitionScorer;
25-
import com.github.oeuvres.alix.lucene.terms.TermLexicon;
2625
import com.github.oeuvres.alix.lucene.terms.IdfTermScorer;
2726
import com.github.oeuvres.alix.lucene.terms.TopTerms;
2827
import com.github.oeuvres.alix.lucene.terms.TopTerms.TermEntry;

0 commit comments

Comments
 (0)