Hi,

I’m trying to implement a TokenFilter that splits words that contains
numbers into a phrase with separate words and numbers. For example I want to
turn v70 into a phrase “v 70”. I’ve implemented a filter that does the
actual split with a regular expression. Then I use this filter in my
analyzer which is passed to the QueryParser. The resulting Query looks fine
+(+words:”v 70”) but I does not return any Hits. If I instead pass in the
input string “v 70” (ignored by the filter) the resulting query looks the
same but I get Hits. Why is this? Does it have something to do with the
QueryParser guessing what kind of query it is by examining the string and
thus presumes that the first string should not be parsed into a PhraseQuery?

 

Anyways if there is a correct way to accomplish what I want could anyone
please give me a hint? One way I thought about is preparsining the query and
construct several subqueries i.e PhraseQuerys and so on and then combine
them in a BooleanQuery but I guess there is a nicer solution?

 

I have a similar problem with another Filter Iäm trying to implement that
should remove certain suffixes and replace them with a wildcard (
bilar->bil*).

 

/William

Reply via email to