The way i have done is , if there is a wildcard , Use WildCardQuery , else other. Here searchFields is an array which contains the column names . search string is the value to be searched.
if ((searchString.indexOf(IOOSConstants.ASTERISK) > -1) || (searchString.indexOf(IOOSConstants.QUESTION_MARK) > -1)) { WildcardQuery wQuery = new WildcardQuery(new Term( searchFields[0], searchString)); booleanQuery.add(wQuery, true, false); if (searchFields.length > 1) { WildcardQuery wQuery2 = new WildcardQuery(new Term( searchFields[1], searchString)); booleanQuery.add(wQuery2, true, false); } } else { Query query = MultiFieldQueryParser.parse(searchString, searchFields, flags, analyzer); booleanQuery.add(query, true, false); } Query queryfilter = MultiFieldQueryParser.parse(filterString, filterFields, flags, analyzer); QueryFilter queryFilter = new QueryFilter(queryfilter); hits = parallelMultiSearcher.search(booleanQuery, queryFilter); In the meanwhile , i thought i would tokenize the string based on space if the input contains spaces and then add them one by one into booleanQuery. But this gave a StringIndexOutOfBoundsException. So am still trying... Thanks for your help . would appreciate greately if you could give me more pointers . Thanks Robin. On Mon, 4 Oct 2004 17:40:05 -0400 (EDT), Stephane James Vaucher <[EMAIL PROTECTED]> wrote: > On Fri, 1 Oct 2004, Robinson Raju wrote: > > > analyzer is StandardAnalyzer. > > i use MultiFieldQueryParser to parse. > > > > The flow is this: > > I have indexed a Database view. Now i need to search against a few columns > > i take in the search criteria and search field , > > construct a wildcard query and add it to a boolean query > > > > WildcardQuery wQuery = new WildcardQuery(new Term(searchFields[0], > > searchString)); > > What is the value of searchString? Is it a word? QueryParser syntax is not > applied here. > Whats does ab* return? > > > booleanQuery.add(wQuery, true, false); > > Query queryfilter = MultiFieldQueryParser.parse(filterString, > > filterFields, flags, analyzer); > > hits = parallelMultiSearcher.search(booleanQuery,queryFilter); > > > > when i dont use wild cards , it is taken as > > +((ITM_SHRT_DSC:natal ITM_SHRT_DSC:tylenol) (ITM_LONG_DSC:natal > > ITM_LONG_DSC:tylenol)) > > But when wildcard is used , it is taken as > > +ITM_SHRT_DSC:nat* tylenol +ITM_LONG_DSC:nat* Tylenol > > ITM_XXX fields are tokenized? > > sv > > > the first return around 300 records , the second , 0. > > > > any help would be appreciated > > Thanks > > Robin > > > > On Fri, 1 Oct 2004 02:06:04 -0400 (EDT), Stephane James Vaucher > > <[EMAIL PROTECTED]> wrote: > > > Can you be a little more precise about how you process your documents? > > > > > > 1) What's your analyser? SimpleAnalyzer? > > > 2) How do you parse the query? Out-of-the-box QueryParser? > > > > > > > can we not enter space or do an OR search with two words one of which > > > > has a wildcard ? > > > > > > Simple answer, yes. > > > > > > Complicated answer, words are delimited by your tokeniser. That's included > > > in your analyser (hence my question above). The asterix syntax comes > > > from using a query parser that transforms the query into a PrefixQuery > > > object. > > > > > > sv > > > > > > On Fri, 1 Oct 2004, Robinson Raju w Hi , > > > > > > > > > > Would there be a problem if one enters space while using wildcards ? > > > > say i search for 'abc' . i get 100 hits as results > > > > 'man' gives - 200 > > > > 'abc man' gives 300 > > > > but > > > > 'ab* man' > > > > 'abc ma*' > > > > ab* ma*' > > > > ab* OR ma* > > > > .. > > > > all of these return 0 results. > > > > can we not enter space or do an OR search with two words one of which > > > > has a wildcard ? > > > > > > > > Regards, > > > > Robin > > > > > > > > --------------------------------------------------------------------- > > > > 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] > > -- Regards, Robin 9886394650 "The merit of an action lies in finishing it to the end" --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]