Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

java - Lucene: Filtering for documents NOT containing a Term -


i have index documents have 2 fields (actually more 800 fields other fields won't concern here):

  • the contents field contains analyzed/tokenized text of document. query string searched in field.
  • the category field contains single category identifier of document. there 2500 different categories, , document may occur in several of them (i.e. document may have multiple category entries. results filtered field.

the index contains 20 mio. documents , 5 gb in size.

the index queried user-provided query string, plus optional set of few categories user not interested in. the question is: how can remove documents matching not query string unwanted categories.

i use booleanquery must_not clause, i.e. this:

booleanquery q = new booleanquery(); q.add(contentquery, booleanclause.must); (string unwanted: unwantedcategories) {     q.add(new termsquery(new term("category", unwanted), booleanclause.must_not); } 

is there way lucene filters? performance issue here, , there few, recurring, variants of unwantedcategories, cachingwrapperfilter lot. also, due way lucene queries generated in existing code base, difficult fit in, whereas filter introduced easily.

in other words, how create filter based on terms must _not_ occur in document?

one word answer: booleanfilter, found minutes after formulating question:

booleanfilter f = new booleanfilter(); (string unwanted: unwantedcategories) {     termsfilter tf = new termsfilter(new term("category", unwanted));     f.add(new filterclause(tf, booleanclause.must_not)); } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -