Skip to content

Commit df045ca

Browse files
committed
Merge branch '2.3.0' into HEAD
Conflicts: README.md pom.xml
2 parents 22b578c + 7f072c8 commit df045ca

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ This plugin enables URL tokenization and token filtering by URL part.
99

1010
| Elasticsearch Version | Plugin Version |
1111
|-----------------------|----------------|
12-
| 2.3.1 | 2.3.1 |
13-
| 2.3.0 | 2.3.0 |
12+
| 2.3.1 | 2.3.1.1 |
13+
| 2.3.0 | 2.3.0.1 |
1414
| 2.2.2 | 2.2.3 |
1515
| 2.2.1 | 2.2.2 |
1616
| 2.2.0 | 2.2.1 |
@@ -24,7 +24,7 @@ This plugin enables URL tokenization and token filtering by URL part.
2424

2525
## Installation
2626
```bash
27-
bin/plugin install https://github.com/jlinn/elasticsearch-analysis-url/releases/download/v2.3.1/elasticsearch-analysis-url-2.3.1.zip
27+
bin/plugin install https://github.com/jlinn/elasticsearch-analysis-url/releases/download/v2.3.1.1/elasticsearch-analysis-url-2.3.1.1.zip
2828
```
2929

3030
## Usage

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.elasticsearch</groupId>
88
<artifactId>elasticsearch-analysis-url</artifactId>
9-
<version>2.3.1</version>
9+
<version>2.3.1.1</version>
1010
<packaging>jar</packaging>
1111
<description>Elasticsearch URL token filter plugin</description>
1212

src/main/java/org/elasticsearch/index/analysis/url/URLTokenFilter.java

+3
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ private boolean advance() throws IOException {
130130
}
131131
throw e;
132132
}
133+
if (tokens.isEmpty()) {
134+
return false;
135+
}
133136
iterator = tokens.iterator();
134137
return true;
135138
} else {

src/test/java/org/elasticsearch/index/analysis/url/URLTokenFilterTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
public class URLTokenFilterTest extends BaseTokenStreamTestCase {
1414
public static final String TEST_HTTP_URL = "http://www.foo.bar.com:9200/index_name/type_name/_search.html?foo=bar&baz=bat#tag";
15+
public static final String TEST_HTTP_URL2 = "http://www.foo.bar.com";
1516
public static final String TEST_HTTPS_URL = "https://www.foo.bar.com:9200/index_name/type_name/_search.html?foo=bar&baz=bat#tag";
1617

1718
@Test
@@ -36,6 +37,7 @@ public void testFilterPort() throws IOException {
3637
@Test
3738
public void testFilterPath() throws IOException {
3839
assertTokenStreamContents(createFilter(TEST_HTTP_URL, URLPart.PATH).setTokenizePath(false), "/index_name/type_name/_search.html");
40+
assertTokenStreamContents(createFilter(TEST_HTTP_URL2, URLPart.PATH).setTokenizePath(false), new String[]{});
3941
}
4042

4143
@Test

src/test/java/org/elasticsearch/index/analysis/url/URLTokenizerTest.java

+8
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ public void testTokenizePath() throws IOException {
8383
}
8484

8585

86+
@Test
87+
public void testTokenizeNoPath() throws Exception {
88+
final String url = "http://www.foo.bar.com:9200";
89+
URLTokenizer tokenizer = createTokenizer(url, URLPart.PATH);
90+
assertTokenStreamContents(tokenizer, stringArray());
91+
}
92+
93+
8694
@Test
8795
public void testTokenizeQuery() throws IOException {
8896
URLTokenizer tokenizer = createTokenizer(TEST_HTTP_URL, URLPart.QUERY);

0 commit comments

Comments
 (0)