Sure, see PerFieldAnalyzerWrapper. It's designed to allow different analyzers for different fields.
Erick On 1/12/07, M A <[EMAIL PROTECTED]> wrote:
Analyzer analyzer = new StandardAnalyzer(new String[]{}); The analyzer used in both cases, would be this one in the code, above. Does this mean i would have to create a new Analyzer and reindex the whole lot? Bearing in mind ofcourse that there is also a free text element also, See this becomes the problem, for the tags I would like an analyser that i can tokenize by space alone since the tags are fed separated by a space, However for the free text, need that to be the Analyser above . i.e. Analyzer analyzer = new StandardAnalyzer(new String[]{}); Is it possible to add 2 different fields to the same document using 2 different analysers? thisis to say field 1 analyser 1 field 2 analyser 2 int he same document .. Are there any implications wrt to doing this On 1/12/07, Erick Erickson <[EMAIL PROTECTED]> wrote: > > What analyzers are you using for your queries and your indexing? > StandardAnalyzer (I believe) will break "A.B" into two tokens , so your > index could contain both tags. So what you really have in the index would > be > story1 A C E > story2: A B P Q (note no '.'). > > searching for B.A would really search for B OR A because of 2 things: > 1> the tokenizer (assuming StandardAnalyzer or any other analyzer that > breaks tokens at punctuation) would break the query into two terms. > 2> the default is OR unless you set the default to AND or specify it in > the > query. > > If you're using different analyzers, this is irrelevant. Also, this > assumes > you're using the query parser. > > If you haven't already, I *strongly* recommend you get a copy of Luke > (google lucene luke). It lets you examine your indexes to see what's > actually been indexed and lets you examine queries to see what the actual > search terms are. It even lets you use different analyzers to see how they > behave when it comes to creating a query. > > Best > Erick > > On 1/11/07, M A <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > We are having some trouble with the results that we get from certain > > queries. > > > > Basically .. we have documents that we index, each document has a bunch > of > > tags, the tags could be of the sort > > > > tags: A, B, C, D.P, E.A etc .. > > > > Each story will contain only a subset of the tags .. > > > > For example > > > > Story 1: tags : A, C, E > > Story 2: tags : B.A, P, Q (note "B.A" is one tag) . > > > > Problem occurs when we run a search with query "A" we get both results, > > but what we should be getting is just Story 1. > > Query "B.A" returns the correct value. > > > > What would i have to ensure that a search for "A" only matches "A" and > > not > > "B.A"? > > > > thanx > > > > > >