[ https://issues.apache.org/jira/browse/LUCENE-7603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15788037#comment-15788037 ]
ASF GitHub Bot commented on LUCENE-7603: ---------------------------------------- Github user dsmiley commented on a diff in the pull request: https://github.com/apache/lucene-solr/pull/129#discussion_r94244009 --- Diff: lucene/core/src/java/org/apache/lucene/util/graph/GraphTokenStreamFiniteStrings.java --- @@ -80,22 +77,41 @@ public boolean incrementToken() throws IOException { } } + private GraphTokenStreamFiniteStrings() { + this.builder = new Automaton.Builder(); + } + /** * Gets the list of finite string token streams from the given input graph token stream. */ - public List<TokenStream> getTokenStreams(final TokenStream in) throws IOException { - // build automation + public static List<TokenStream> getTokenStreams(final TokenStream in) throws IOException { + GraphTokenStreamFiniteStrings gfs = new GraphTokenStreamFiniteStrings(); + return gfs.process(in); + } + + /** + * Builds automaton and builds the finite string token streams. + */ + private List<TokenStream> process(final TokenStream in) throws IOException { build(in); List<TokenStream> tokenStreams = new ArrayList<>(); final FiniteStringsIterator finiteStrings = new FiniteStringsIterator(det); for (IntsRef string; (string = finiteStrings.next()) != null; ) { final BytesRef[] tokens = new BytesRef[string.length]; --- End diff -- Hmm; rather than materializing an array of tokens and increments, maybe you could simply give the IntsRefString to BytesRefArrayTokenStream (and make BRATS not static) so that it could do this on the fly? Not a big deal either way (current or my proposal). If you do as I suggest then BRATS would no longer be a suitable name; maybe simply FiniteStringTokenStream or CustomTokenStream. > Support Graph Token Streams in QueryBuilder > ------------------------------------------- > > Key: LUCENE-7603 > URL: https://issues.apache.org/jira/browse/LUCENE-7603 > Project: Lucene - Core > Issue Type: Improvement > Components: core/queryparser, core/search > Reporter: Matt Weber > > With [LUCENE-6664|https://issues.apache.org/jira/browse/LUCENE-6664] we can > use multi-term synonyms query time. A "graph token stream" will be created > which which is nothing more than using the position length attribute on > stacked tokens to indicate how many positions a token should span. Currently > the position length attribute on tokens is ignored during query parsing. > This issue will add support for handling these graph token streams inside the > QueryBuilder utility class used by query parsers. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org