"Jiho Han" <[EMAIL PROTECTED]> wrote on 15/01/2007 10:50:14:
> I looked through the archive a bit and found some Q & A's regarding this > but I didn't see anything definitive so I thought I'd ask again... > > Basically, I have a web page that can search through a database table > across multiple servers. > So imagine that there are 100 different databases spread across a number > of servers but the schema is same. > I created an index with fields specific to each row in a particular > table such as NAME, TYPE, COMPANY, etc. in addition to SERVER, DATABASE > so I can capture where they are from. > > Ultimately, what I want is a single HTML input field that can capture a > query expression and instantiate a searcher and return a result set. > This querystring should be in any number of forms: > > Ex) > John Doe ABC Company (which would search for each word OR'ed in all of > the fields) > "John Doe" And "ABC Company" (which would search for "John Doe" AND'ed > with "ABC Company" in all of the fields) > NAME:"John Doe" COMPANY:"ABC Company" (which would search for results > where either NAME contains "John Doe" OR COMPANY contains "ABC Company") > NAME:"John Doe" And COMPANY:"ABC Company" (which would search in each > field but must match both fields) > +NAME:"John Doe" +COMPANY:"ABC Company" (which I understand is same as > the previous line - if not please correct me) > > So I am wondering if a single instance of Query and > MultiFieldQueryParser can do this. Do I need any other special > processing? > > Here's what I have right now (C#): > > string[] searchFields = new string[] { > "SERVER", "DATABASE", "NAME", "COMPANY", "TYPE" > }; > > MultiFieldQueryParser parser = new > MultiFieldQueryParser(searchFields, new StandardAnalyzer()); > parser.SetDefaultOperator(QueryParser.Operator.OR); > Query query = parser.Parse(querystring); > > Then I pass 'query' into MultiSearcher. Well, it's not returning the > results as I expect. How is it different from what you expect? One thing to fix is: change And to AND If still results seem wrong try printing the query (toString()) - is that as you expect? Doron > Can some show me what I need to change? > Thanks > > Jiho Han > Senior Software Engineer > Infinity Info Systems > The Sales Technology Experts > Tel: 212.563.4400 x6375 > Fax: 212.760.0540 > [EMAIL PROTECTED] > www.infinityinfo.com <http://www.infinityinfo.com/> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]