修改代码字符编码
This commit is contained in:
@@ -22,7 +22,7 @@ public interface DataStore extends Reloadable {
|
||||
Collection<Index> getIndexes() throws DataStoreException;
|
||||
|
||||
/**
|
||||
* °´²éѯÌõ¼þÖØ½¨Ë÷Òý
|
||||
* 按查询条件重建索引
|
||||
*
|
||||
* @param query
|
||||
* @throws DataStoreException
|
||||
|
||||
+28
-28
@@ -117,13 +117,13 @@ public class DataStoreImpl implements DataStore {
|
||||
for(Field field : storeConfig.getFields()) {
|
||||
caseFields.put(field.getName(), 1);
|
||||
}
|
||||
// 如没有查询条件,则全部重建
|
||||
// 如没有查询条件,则全部重建
|
||||
if (null == query || CollectionUtils.isEmpty(query.keySet())) {
|
||||
if (indexing.compareAndSet(false, true)) {
|
||||
String currentVersion = Core.VERSION_DATE_FORMAT.format(new Date()); // 操作发起的时间戳
|
||||
String currentVersion = Core.VERSION_DATE_FORMAT.format(new Date()); // 操作发起的时间戳
|
||||
Iterator<? extends BSONObject> i = this.getMongoCollection().find(new BasicDBObject(), caseFields).addOption(Bytes.QUERYOPTION_NOTIMEOUT);
|
||||
core.reIndex(null, i);
|
||||
// 删除重建之前的索引
|
||||
// 删除重建之前的索引
|
||||
query = new BasicBSONObject();
|
||||
BSONObject versionObj = new BasicBSONObject();
|
||||
versionObj.put("$lte", currentVersion);
|
||||
@@ -146,7 +146,7 @@ public class DataStoreImpl implements DataStore {
|
||||
|
||||
private interface Closure {
|
||||
/**
|
||||
* 返回false则跳出遍历
|
||||
* 返回false则跳出遍历
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
@@ -157,7 +157,7 @@ public class DataStoreImpl implements DataStore {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据查询条件重建索引
|
||||
* 根据查询条件重建索引
|
||||
*
|
||||
* @param query
|
||||
* @throws DataStoreException
|
||||
@@ -189,8 +189,8 @@ public class DataStoreImpl implements DataStore {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据query遍历。<br>
|
||||
* 这个方法只适用于reIndex, update, remove等会重建索引的操作, 不能简单的用来遍历
|
||||
* 根据query遍历。<br>
|
||||
* 这个方法只适用于reIndex, update, remove等会重建索引的操作, 不能简单的用来遍历
|
||||
*
|
||||
* @param operationName
|
||||
* @param query
|
||||
@@ -202,14 +202,14 @@ public class DataStoreImpl implements DataStore {
|
||||
private void iterateSolrQuery(String operationName, BSONObject query, int batchSize, Closure closure) throws SolrException,
|
||||
DataStoreException {
|
||||
if (null == query.get(SolrSchema.VERTION)) {
|
||||
String currentVersion = Core.VERSION_DATE_FORMAT.format(new Date()); // 操作发起的时间戳
|
||||
String currentVersion = Core.VERSION_DATE_FORMAT.format(new Date()); // 操作发起的时间戳
|
||||
BSONObject versionObj = new BasicBSONObject();
|
||||
versionObj.put("$lte", currentVersion);
|
||||
query.put(SolrSchema.VERTION, versionObj); // 只遍历时间戳之前的数据
|
||||
query.put(SolrSchema.VERTION, versionObj); // 只遍历时间戳之前的数据
|
||||
}
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
int currentPage = 0; // 当前遍历页面
|
||||
int currentPage = 0; // 当前遍历页面
|
||||
long c = 0;
|
||||
long lastC = c;
|
||||
int round = 0;
|
||||
@@ -218,9 +218,9 @@ public class DataStoreImpl implements DataStore {
|
||||
int lastNumFound = -1;
|
||||
while (true) {
|
||||
response = findInSolr(query, null, null, currentPage * batchSize, batchSize, true, true);
|
||||
if (currentPage == 0) {// 每轮第一次迭代
|
||||
if (currentPage == 0) {// 每轮第一次迭代
|
||||
if (lastNumFound == -1) {
|
||||
// 第一轮
|
||||
// 第一轮
|
||||
lastNumFound = response.getNumFound();
|
||||
} else if (response.getNumFound() > 0 && lastNumFound == response.getNumFound()) {
|
||||
long sleep = 20000;
|
||||
@@ -234,7 +234,7 @@ public class DataStoreImpl implements DataStore {
|
||||
}
|
||||
response = findInSolr(query, null, null, 0, 1, true, true);
|
||||
if (response.getNumFound() > 0 && lastNumFound == response.getNumFound()) {
|
||||
// TODO: 可能需要删除solr中有但mongodb中没有的索引数据
|
||||
// TODO: 可能需要删除solr中有但mongodb中没有的索引数据
|
||||
// core.deleteByQuery(query);
|
||||
break;
|
||||
}
|
||||
@@ -247,11 +247,11 @@ public class DataStoreImpl implements DataStore {
|
||||
|
||||
int returnedSize = response.getNumReturned();
|
||||
List<String> idList = response.getIdList();
|
||||
// 有可能为空
|
||||
// 有可能为空
|
||||
if (null != idList && idList.size() > 0) {
|
||||
// 执行重建
|
||||
// 执行重建
|
||||
if (!closure.execute(idList)) {
|
||||
// 返回false则不再遍历
|
||||
// 返回false则不再遍历
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -263,18 +263,18 @@ public class DataStoreImpl implements DataStore {
|
||||
lastC = c;
|
||||
}
|
||||
|
||||
// 因为重建后的索引已不在query条件内,所以query条件的整个集合大小随着遍历的往前进行,一直在变动
|
||||
// 而分页是顺序向前的,所以一次执行,不能保证全部遍历到,所以要多次执行
|
||||
// 因为重建后的索引已不在query条件内,所以query条件的整个集合大小随着遍历的往前进行,一直在变动
|
||||
// 而分页是顺序向前的,所以一次执行,不能保证全部遍历到,所以要多次执行
|
||||
if (currentPage == 0 && returnedSize >= lastNumFound) {
|
||||
// 第一页数量就小于BATCH_SIZE,则不用往下遍历
|
||||
// 第一页数量就小于BATCH_SIZE,则不用往下遍历
|
||||
break;
|
||||
} else if (returnedSize == 0 || roundIndexCount >= lastNumFound) {
|
||||
// 本轮重建数量大于总数量,从头再来过
|
||||
// 本轮重建数量大于总数量,从头再来过
|
||||
currentPage = 0;
|
||||
round++;
|
||||
roundIndexCount = 0;
|
||||
} else {
|
||||
// 当前页数量跟BATCH_SIZE一致,向前翻页
|
||||
// 当前页数量跟BATCH_SIZE一致,向前翻页
|
||||
currentPage++;
|
||||
}
|
||||
}
|
||||
@@ -519,11 +519,11 @@ public class DataStoreImpl implements DataStore {
|
||||
final DBObject update = new BasicDBObject();
|
||||
update.putAll(data);
|
||||
|
||||
// 更新大字段关联文件
|
||||
// 更新大字段关联文件
|
||||
if (storeConfig.isTextFieldToGridFS()) {
|
||||
fileStore.update(objIdList, update);
|
||||
|
||||
// 把要更新的大字段数据,置为null,不需要把数据插入主表
|
||||
// 把要更新的大字段数据,置为null,不需要把数据插入主表
|
||||
BSONObject realData = (BSONObject) update.get("$set");
|
||||
if (null != realData) {
|
||||
Set<String> removeField = new HashSet<String>();
|
||||
@@ -545,7 +545,7 @@ public class DataStoreImpl implements DataStore {
|
||||
}
|
||||
getMongoCollection().update(seletor, update, false, true, WriteConcern.NORMAL);
|
||||
|
||||
// 重建索引
|
||||
// 重建索引
|
||||
core.save(getMongoCollection().find(seletor).addOption(Bytes.QUERYOPTION_NOTIMEOUT));
|
||||
return true;
|
||||
}
|
||||
@@ -591,7 +591,7 @@ public class DataStoreImpl implements DataStore {
|
||||
}
|
||||
getMongoCollection().remove(seletor, WriteConcern.NORMAL);
|
||||
|
||||
// 删除大字段的关联文件
|
||||
// 删除大字段的关联文件
|
||||
if (storeConfig.isTextFieldToGridFS()) {
|
||||
fileStore.remove(objIdList);
|
||||
}
|
||||
@@ -618,13 +618,13 @@ public class DataStoreImpl implements DataStore {
|
||||
throw new DataStoreException("invalid value: " + bson.get(field) + " of field '" + field + "'!");
|
||||
}
|
||||
|
||||
// 若是大字段,将内容保存至fileObj后存入fileList
|
||||
// 若是大字段,将内容保存至fileObj后存入fileList
|
||||
if (storeConfig.isBigField(field)) {
|
||||
hasBigField = true;
|
||||
|
||||
fileObj.put(field, bson.get(field));
|
||||
|
||||
// 主表中不保存该字段内容
|
||||
// 主表中不保存该字段内容
|
||||
bson.put(field, null);
|
||||
}
|
||||
}
|
||||
@@ -636,7 +636,7 @@ public class DataStoreImpl implements DataStore {
|
||||
this.getMongoCollection().save(dbObj, WriteConcern.NORMAL);
|
||||
}
|
||||
|
||||
// 保存大字段
|
||||
// 保存大字段
|
||||
if (hasBigField)
|
||||
fileStore.save(fileList, insertList);
|
||||
} else {
|
||||
|
||||
@@ -16,26 +16,26 @@ public interface FileStore {
|
||||
/**
|
||||
*
|
||||
* @param fileList
|
||||
* 仅包含大字段的文档列表
|
||||
* 仅包含大字段的文档列表
|
||||
* @param dbObjList
|
||||
* 已经保存到数据库的主对象列表
|
||||
* 已经保存到数据库的主对象列表
|
||||
* @throws IllegalArgumentException
|
||||
* 大字段数据不支持默认编码时抛出
|
||||
* 大字段数据不支持默认编码时抛出
|
||||
*/
|
||||
void save(List<DBObject> fileList, List<DBObject> dbObjList) throws DataStoreException;
|
||||
|
||||
/**
|
||||
* 删除指定的大字段内容
|
||||
* 删除指定的大字段内容
|
||||
*
|
||||
* @param objIdList
|
||||
* 删除的主对象的id列表
|
||||
* 删除的主对象的id列表
|
||||
* @param removeFields
|
||||
* 需要删除的大字段名集合
|
||||
* 需要删除的大字段名集合
|
||||
*/
|
||||
public void remove(List<String> objIdList, Set<String> removeFields);
|
||||
|
||||
/**
|
||||
* 删除所有大字段内容
|
||||
* 删除所有大字段内容
|
||||
*
|
||||
* @param objIdList
|
||||
*/
|
||||
@@ -43,22 +43,22 @@ public interface FileStore {
|
||||
|
||||
/**
|
||||
* @param objIdList
|
||||
* 待更新的主对象id列表
|
||||
* 待更新的主对象id列表
|
||||
* @param data
|
||||
* 更新文档
|
||||
* 更新文档
|
||||
* @throws UnsupportedEncodingException
|
||||
* 大字段数据不支持默认编码时抛出
|
||||
* 大字段数据不支持默认编码时抛出
|
||||
*/
|
||||
public void update(List<String> objIdList, BSONObject data) throws DataStoreException;
|
||||
|
||||
/**
|
||||
* @param docList
|
||||
* 查询的结果文档
|
||||
* 查询的结果文档
|
||||
* @param fields
|
||||
* 查询字段对象
|
||||
* 查询字段对象
|
||||
* @return
|
||||
* @throws IOException
|
||||
* 读取大字段数据异常时、大字段数据不支持默认编码时抛出
|
||||
* 读取大字段数据异常时、大字段数据不支持默认编码时抛出
|
||||
*/
|
||||
public List<DBObject> find(List<DBObject> docList, BSONObject fields) throws DataStoreException;
|
||||
}
|
||||
|
||||
+15
-15
@@ -34,7 +34,7 @@ public class FileStoreImpl implements FileStore {
|
||||
public FileStoreImpl(GridFS gridFS, Collection<Field> fields) {
|
||||
this.gridFS = gridFS;
|
||||
|
||||
// 把大字段的字段名放入set
|
||||
// 把大字段的字段名放入set
|
||||
bigFieldSet = new HashMap<String, Field>();
|
||||
for (Field field : fields) {
|
||||
if (field.isBigField()) {
|
||||
@@ -49,7 +49,7 @@ public class FileStoreImpl implements FileStore {
|
||||
|
||||
Iterator<DBObject> dbObjIt = dbObjList.iterator();
|
||||
for (Iterator<DBObject> fileIt = fileList.iterator(); fileIt.hasNext();) {
|
||||
// 取得已保存主对象的id
|
||||
// 取得已保存主对象的id
|
||||
String id = ((ObjectId) dbObjIt.next().get("_id")).toString();
|
||||
|
||||
BSONObject file = fileIt.next();
|
||||
@@ -95,11 +95,11 @@ public class FileStoreImpl implements FileStore {
|
||||
}
|
||||
|
||||
public void remove(List<String> objIdList, Set<String> removeFields) {
|
||||
// 删除表的所有大字段
|
||||
// 删除表的所有大字段
|
||||
if (null == removeFields)
|
||||
removeFields = bigFieldSet.keySet();
|
||||
|
||||
// 若到删除的字段中没有大字段,直接返回
|
||||
// 若到删除的字段中没有大字段,直接返回
|
||||
if (removeFields.size() == 0)
|
||||
return;
|
||||
|
||||
@@ -108,7 +108,7 @@ public class FileStoreImpl implements FileStore {
|
||||
idList.add(objId);
|
||||
}
|
||||
|
||||
// 删除大字段关联的GridFS
|
||||
// 删除大字段关联的GridFS
|
||||
DBObject fileSeletor = new BasicDBObject();
|
||||
fileSeletor.put("filename", new BasicDBObject("$in", idList));
|
||||
fileSeletor.put("contentType", new BasicDBObject("$in", removeFields));
|
||||
@@ -116,10 +116,10 @@ public class FileStoreImpl implements FileStore {
|
||||
}
|
||||
|
||||
public void update(List<String> objIdList, BSONObject data) throws DataStoreException {
|
||||
// 待删除的字段
|
||||
// 待删除的字段
|
||||
BSONObject unset = (BSONObject) data.get("$unset");
|
||||
if (null != unset) {
|
||||
// 待删除的大字段set
|
||||
// 待删除的大字段set
|
||||
Set<String> removeSet = new HashSet<String>();
|
||||
for (String field : unset.keySet()) {
|
||||
if (bigFieldSet.containsKey(field))
|
||||
@@ -130,7 +130,7 @@ public class FileStoreImpl implements FileStore {
|
||||
remove(objIdList, removeSet);
|
||||
}
|
||||
|
||||
// 更新数据
|
||||
// 更新数据
|
||||
BSONObject set = (BSONObject) data.get("$set");
|
||||
if (null == set)
|
||||
return;
|
||||
@@ -142,14 +142,14 @@ public class FileStoreImpl implements FileStore {
|
||||
}
|
||||
}
|
||||
|
||||
// 更新数据中没有大字段
|
||||
// 更新数据中没有大字段
|
||||
if (fileMap.size() == 0)
|
||||
return;
|
||||
|
||||
// 删除大字段关联的GridFS
|
||||
// 删除大字段关联的GridFS
|
||||
remove(objIdList, fileMap.keySet());
|
||||
|
||||
// 将新的内容存入GridFS
|
||||
// 将新的内容存入GridFS
|
||||
for (String objId : objIdList) {
|
||||
String id = objId;
|
||||
for (String fieldName : fileMap.keySet()) {
|
||||
@@ -184,7 +184,7 @@ public class FileStoreImpl implements FileStore {
|
||||
}
|
||||
|
||||
public List<DBObject> find(List<DBObject> docList, BSONObject fields) throws DataStoreException {
|
||||
// 判断查询的字段中有没有大字段
|
||||
// 判断查询的字段中有没有大字段
|
||||
Set<String> queryBigField = new HashSet<String>();
|
||||
if (null == fields) {
|
||||
queryBigField = bigFieldSet.keySet();
|
||||
@@ -196,7 +196,7 @@ public class FileStoreImpl implements FileStore {
|
||||
}
|
||||
}
|
||||
|
||||
// 没有大字段,则返回原结果文档
|
||||
// 没有大字段,则返回原结果文档
|
||||
if (queryBigField.size() == 0)
|
||||
return docList;
|
||||
|
||||
@@ -217,9 +217,9 @@ public class FileStoreImpl implements FileStore {
|
||||
List<GridFSDBFile> fileList = gridFS.find(fileSeletor);
|
||||
|
||||
for (GridFSDBFile file : fileList) {
|
||||
// 对应主记录id
|
||||
// 对应主记录id
|
||||
String id = file.getFilename();
|
||||
// 对应主记录大字段名
|
||||
// 对应主记录大字段名
|
||||
String fieldName = file.getContentType();
|
||||
|
||||
DBObject obj = docMap.get(id);
|
||||
|
||||
@@ -53,10 +53,10 @@ public class Field {
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证一个值是否匹配其对应的类型
|
||||
* 验证一个值是否匹配其对应的类型
|
||||
*
|
||||
* @param value
|
||||
* @return 匹配则返回true,不匹配返回false
|
||||
* @return 匹配则返回true,不匹配返回false
|
||||
*/
|
||||
public boolean validate(Object value) {
|
||||
if (this.required && value == null) {
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public abstract class MessageHandler<T extends MongoMessage> {
|
||||
}
|
||||
|
||||
/**
|
||||
* ´¦ÀíÌØ¶¨µÄÏûÏ¢
|
||||
* 处理特定的消息
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
|
||||
+3
-3
@@ -269,11 +269,11 @@ public class QueryMessageHandler extends MessageHandler<QueryMessage> {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 不带参数重建:db.foo.reIndex() 或 db.foo.runCommand('reIndex')
|
||||
* 不带参数重建:db.foo.reIndex() 或 db.foo.runCommand('reIndex')
|
||||
* </P>
|
||||
*
|
||||
* <p>
|
||||
* 带参数重建:db.foo.runCommand('reIndex',{query:{cat:'sell',city:'上海'}})
|
||||
* 带参数重建:db.foo.runCommand('reIndex',{query:{cat:'sell',city:'上海'}})
|
||||
* <p>
|
||||
*
|
||||
* @param message
|
||||
@@ -285,7 +285,7 @@ public class QueryMessageHandler extends MessageHandler<QueryMessage> {
|
||||
BSONObject query = message.getQuery();
|
||||
String collectionName = (String) query.get("reIndex");
|
||||
DataStore dataStore = this.dataStoreContext.getDataStore(dbName + "." + collectionName);
|
||||
// 新增查询条件 add by yukai 2011/07/14
|
||||
// 新增查询条件 add by yukai 2011/07/14
|
||||
BSONObject doc = new BasicBSONObject();
|
||||
Object realQuery = query.get("query");
|
||||
if (null == realQuery)
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.fangjia.datastore.QueryResponse;
|
||||
import com.fangjia.datastore.config.Reloadable;
|
||||
|
||||
/**
|
||||
* 一个Core对应一个solr索引
|
||||
* 一个Core对应一个solr索引
|
||||
*
|
||||
* @author velna
|
||||
*
|
||||
@@ -23,14 +23,14 @@ public interface Core extends Reloadable {
|
||||
public final static FastDateFormat VERSION_DATE_FORMAT = FastDateFormat.getInstance("yyMMddHHmmssSSS");
|
||||
|
||||
/**
|
||||
* 得到索引名称
|
||||
* 得到索引名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* 得到所有索引字段
|
||||
* 得到所有索引字段
|
||||
*
|
||||
* @return
|
||||
* @throws SolrException
|
||||
@@ -38,53 +38,53 @@ public interface Core extends Reloadable {
|
||||
Collection<Index> getIndexes() throws SolrException;
|
||||
|
||||
/**
|
||||
* 添加索引字段,必要的话重建索引
|
||||
* 添加索引字段,必要的话重建索引
|
||||
*
|
||||
* @param indexes
|
||||
* 添加的索引字段列表
|
||||
* 添加的索引字段列表
|
||||
* @param iterator
|
||||
* 用于遍历数据
|
||||
* 用于遍历数据
|
||||
* @throws SolrException
|
||||
*/
|
||||
void ensureIndex(Collection<Index> indexes, Iterator<? extends BSONObject> iterator) throws SolrException;
|
||||
|
||||
/**
|
||||
* 添加索引字段,必要的话重建索引
|
||||
* 添加索引字段,必要的话重建索引
|
||||
*
|
||||
* @param index
|
||||
* 添加的索引字段列表
|
||||
* 添加的索引字段列表
|
||||
* @param iterator
|
||||
* 用于遍历数据
|
||||
* 用于遍历数据
|
||||
* @throws SolrException
|
||||
*/
|
||||
void ensureIndex(Index index, Iterator<? extends BSONObject> iterator) throws SolrException;
|
||||
|
||||
/**
|
||||
* 重建索引
|
||||
* 重建索引
|
||||
*
|
||||
* @param objIdList
|
||||
* 待重建的ObjIdList,全部重建时为null
|
||||
* 待重建的ObjIdList,全部重建时为null
|
||||
* @param iterator
|
||||
* 用于遍历数据
|
||||
* 用于遍历数据
|
||||
*/
|
||||
void reIndex(List<String> objIdList, Iterator<? extends BSONObject> iterator) throws SolrException;
|
||||
|
||||
/**
|
||||
* 保存索引文档
|
||||
* 保存索引文档
|
||||
*
|
||||
* @param doc
|
||||
* @throws SolrException
|
||||
*/
|
||||
// void save(BSONObject doc) throws SolrException;
|
||||
/**
|
||||
* 保存多个索引文档
|
||||
* 保存多个索引文档
|
||||
*
|
||||
* @param docList
|
||||
* @throws SolrException
|
||||
*/
|
||||
// void save(List<? extends BSONObject> docList) throws SolrException;
|
||||
/**
|
||||
* 保存多个索引文档
|
||||
* 保存多个索引文档
|
||||
*
|
||||
* @param iterator
|
||||
* @throws SolrException
|
||||
@@ -92,21 +92,21 @@ public interface Core extends Reloadable {
|
||||
void save(Iterator<? extends BSONObject> iterator) throws SolrException;
|
||||
|
||||
/**
|
||||
* 根据ID删除索引文档
|
||||
* 根据ID删除索引文档
|
||||
*
|
||||
* @param id
|
||||
* @throws SolrException
|
||||
*/
|
||||
// void deleteById(String id) throws SolrException;
|
||||
/**
|
||||
* 根据ID列表删除索引文档
|
||||
* 根据ID列表删除索引文档
|
||||
*
|
||||
* @param ids
|
||||
* @throws SolrException
|
||||
*/
|
||||
// void deleteById(List<String> ids) throws SolrException;
|
||||
/**
|
||||
* 根据查询删除索引文档
|
||||
* 根据查询删除索引文档
|
||||
*
|
||||
* @param query
|
||||
* @throws SolrException
|
||||
@@ -114,22 +114,22 @@ public interface Core extends Reloadable {
|
||||
void deleteByQuery(BSONObject query) throws SolrException;
|
||||
|
||||
/**
|
||||
* 查询索引
|
||||
* 查询索引
|
||||
*
|
||||
* @param query
|
||||
* 查询条件
|
||||
* 查询条件
|
||||
* @param sort
|
||||
* 排序条件
|
||||
* 排序条件
|
||||
* @param facet
|
||||
* facet查询条件
|
||||
* facet查询条件
|
||||
* @param skip
|
||||
* 从第skip条开始返回结果
|
||||
* 从第skip条开始返回结果
|
||||
* @param limit
|
||||
* 返回limit条结果
|
||||
* 返回limit条结果
|
||||
* @param fromMaster
|
||||
* 是否从主索引中读取数据
|
||||
* 是否从主索引中读取数据
|
||||
* @param bulk
|
||||
* 是否使用bulk查询
|
||||
* 是否使用bulk查询
|
||||
* @return
|
||||
* @throws SolrException
|
||||
*/
|
||||
|
||||
+4
-4
@@ -22,7 +22,7 @@ public class SolrQueryBuilder {
|
||||
public final static FastDateFormat DATE_FORMAT = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", TimeZone
|
||||
.getTimeZone("UTC"));
|
||||
/**
|
||||
* 约定:以$$开头的字符串不需要特殊字符转义
|
||||
* 约定:以$$开头的字符串不需要特殊字符转义
|
||||
*/
|
||||
public final static String NO_ESCAPSE = "$$";
|
||||
|
||||
@@ -150,9 +150,9 @@ public class SolrQueryBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取真实value<br/>
|
||||
* 如果是非string的value,返回转义后的原值<br/>
|
||||
* 如果是string型,如果以$$开头,则截取$$后面的字符且不需要转义
|
||||
* 获取真实value<br/>
|
||||
* 如果是非string的value,返回转义后的原值<br/>
|
||||
* 如果是string型,如果以$$开头,则截取$$后面的字符且不需要转义
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ public class SolrServerImpl implements SolrServer {
|
||||
}
|
||||
|
||||
private void checkFilter() {
|
||||
// 5·ÖÖÓÒ»´Î
|
||||
// 5分钟一次
|
||||
if (System.currentTimeMillis() - lastFilterTime < 300000) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user