Concatenating all your searchable fields into one is certainly what I'd do. Simple and efficient.
And yes, you can perform range searches via the query parser - the example you give matches the one in the docs at http://lucene.apache.org/core/4_3_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Boolean_operators so it looks like you've found the docs. Assemble your query as you want e.g. "contents: important AND date:[whatever TO whatever]". You'll get better performance by indexing the data as a NumericField and using NumericRangeQuery or, better if often searching over the same date range, NumericRangeFilter optionally cached with CachingWrapperFilter. I don't think the standard query parser supports ranges on a NumericField directly. See http://stackoverflow.com/questions/5026185/how-do-i-make-the-queryparser-in-lucene-handle-numeric-ranges or one of the other hits for a google search on the subject. Or simply build the query up in code. -- Ian. On Wed, Jun 26, 2013 at 9:36 PM, <raghavendra.k....@barclays.com> wrote: > Hi, > > I have indexed a database table which has about 70 columns out of which 60 > columns have been indexed and the rest have been stored. There are 70 million > records in this table. This is a static table and hence I plan to index them > at once and then perform the search on these indices. > > I performed a brief comparison between the usually discussed 2 options: > > - Concatenate all the fields separated by a space and then search my > keyword in this single field. > > - Store the 60 columns in 60 separate fields while indexing and then > use MultiFieldQueryParser to search the single keyword in all the 60 fields. > > I noticed that the performance was significantly better in option 1. Hence I > continued with it. Please let me know if you still think this is not an > efficient approach. > > Question 2: > > Among the 60 columns, one column is a date field and I need to perform a > date-range filter while searching for a keyword. I read that date-range > filter can be performed as below in the documentation. > > mod_date:[20020101 TO 20030101] > > I presume mod_date is the name of one of the fields stored in the indexes. Do > I have to use MultiFieldQueryParser to be able to perform date-range filter > or is there a way to perform date-range and string search using the > QueryParser? > > Right now, to search a word "important", I search it against one field (which > is a list of concatenated columns). Do you think I can do that as well as > filter records by the date column? > > Regards, > Raghu > > > _______________________________________________ > > This message is for information purposes only, it is not a recommendation, > advice, offer or solicitation to buy or sell a product or service nor an > official confirmation of any transaction. It is directed at persons who are > professionals and is not intended for retail customer use. Intended for > recipient only. This message is subject to the terms at: > www.barclays.com/emaildisclaimer. > > For important disclosures, please see: > www.barclays.com/salesandtradingdisclaimer regarding market commentary from > Barclays Sales and/or Trading, who are active market participants; and in > respect of Barclays Research, including disclosures relating to specific > issuers, please see http://publicresearch.barclays.com. > > _______________________________________________ --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org