sth about solr and other opensource utils
solr1 drill data by random,eg.&random_123
solrQuery.addSortField("random_"+rand.nextInt(1000),SolrQuery.ORDER.desc);
2search id not equal to 222
eg.-id:222
3 deleteById(List ids) in solrj
we should delete anything by id As much as possible,using deleteByQuery function may occur some problem.
4 to get facet result we need to set facet and facet.field,also rows=0 is needed
5 if you use dismax to search,you should use q="val" instead of q="title:val"
6 highlightparams : &hl=true&hl.fl=title
7 show score params :&fl=score ,usefulscore willspread out before us when you search some words
8 delete url
update/?stream.body=mm&stream.contentType=text/xml;charset=utf-8&commit=true
9 clear update docs
after we commit docs,we need to use "this.docs.clear()"to clear the queue stored docs
10 optimize
optimizing one time per day is a good choice
11 get all the data which field value's length >0
q=fieldName:["" To *]
12 use underline' can replace the default operator
SolrQuery.setParam("q.op", "OR");
13 use dismax+qf to search instead of default text
14 url complex/analysis/field?q=param to get split words
15 if use mm, %25 is needed after urllink
16 query with q only will get better performance than 'q&fq'
json util
we often use net.sf.json and org.json.simple to help us do explaining,on use we found some string cannotbe decoded well bynet.sf.json ,
soorg.json.simple is good complement .After import org.json we may use JSONParser to change string to JSONObject.
For importingnet.sf.json,we may change list object to JSONArray,and decode json text to json object
and then use a function(JSONObject.toBean(jsonObj,className)) to convert jsonObj to class object
页:
[1]