-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate token offsets and types through UrlTokenFilter
- Loading branch information
Showing
9 changed files
with
117 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/org/elasticsearch/index/analysis/url/Token.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.elasticsearch.index.analysis.url; | ||
|
||
import com.google.common.base.Objects; | ||
import org.elasticsearch.index.analysis.URLPart; | ||
|
||
/** | ||
* @author Joe Linn | ||
* 8/14/2016 | ||
*/ | ||
class Token { | ||
private final String token; | ||
private final URLPart part; | ||
private final int start; | ||
private final int end; | ||
|
||
public Token(String token, URLPart part, int start, int end) { | ||
this.token = token; | ||
this.part = part; | ||
this.start = start; | ||
this.end = end; | ||
} | ||
|
||
public String getToken() { | ||
return token; | ||
} | ||
|
||
public URLPart getPart() { | ||
return part; | ||
} | ||
|
||
public int getStart() { | ||
return start; | ||
} | ||
|
||
public int getEnd() { | ||
return end; | ||
} | ||
|
||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == null || !(obj instanceof Token)) { | ||
return false; | ||
} | ||
Token that = (Token) obj; | ||
return this.start == that.start | ||
&& this.end == that.end | ||
&& Objects.equal(this.token, that.token) | ||
&& Objects.equal(this.part, that.part); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = token != null ? token.hashCode() : 0; | ||
result = 31 * result + part.hashCode(); | ||
result = 31 * result + start; | ||
result = 31 * result + end; | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters