zoukankan      html  css  js  c++  java
  • sth about solr and other opensource utils

    solr

    1 drill data by random,eg.&random_123

     solrQuery.addSortField("random_"+rand.nextInt(1000),SolrQuery.ORDER.desc);

    2  search id not equal to 222

     eg.-id:222

    3 deleteById(List<String> 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 highlight  params : &hl=true&hl.fl=title

    7 show score params :&fl=score ,useful  score will  spread out before us when you search some words

    8 delete url

       update/?stream.body=<delete><id>mm</id></delete>&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 cannot  be decoded well by  net.sf.json ,

    so  org.json.simple is good complement .After import org.json we may use JSONParser to change string to JSONObject.

      For importing  net.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

        

  • 相关阅读:
    【转自百度贴吧】把古诗最后三个字改为“日了狗”,看谁最有才!
    计划!
    [BZOJ2424][HAOI2010]订货
    [BZOJ1026][SCOI2009]windy数
    【作文】高考之外
    [AYYZVijos1761]运输问题
    [BZOJ1047][HAOI2007]理想的正方形
    [NOIP2015]代码
    新的独立博客
    不忘初心,方得始终——NOIP2016前的感悟
  • 原文地址:https://www.cnblogs.com/ai464068163/p/2375468.html
Copyright © 2011-2022 走看看