|
@@ -48,6 +48,20 @@ public class PatentStarApiService {
|
|
|
}
|
|
|
|
|
|
public static String formQuery(String query) {
|
|
|
+ String regexSim = "\\'.*?\\'";
|
|
|
+ Pattern patternSim = Pattern.compile(regexSim);
|
|
|
+ Matcher matcherSim = patternSim.matcher(query);
|
|
|
+ Map<String, String> map = new LinkedHashMap<>();
|
|
|
+ Integer i=1;
|
|
|
+ while (matcherSim.find()) {
|
|
|
+ String aa =matcherSim.group();
|
|
|
+ map.put("$"+i,matcherSim.group());
|
|
|
+ query = query.replaceFirst(matcherSim.group(),"\\$"+i);
|
|
|
+ i++;
|
|
|
+ System.out.println(query);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 统一改成大写
|
|
|
query = query.toUpperCase();
|
|
|
query = "(" + query + ")";
|
|
|
query = query
|
|
@@ -55,6 +69,11 @@ public class PatentStarApiService {
|
|
|
.replace(" OR ", "+")
|
|
|
.replace(" NOT ", "-");
|
|
|
|
|
|
+ for (String key:map.keySet())
|
|
|
+ {
|
|
|
+ query=query.replace(key,map.get(key));
|
|
|
+
|
|
|
+ }
|
|
|
//记录偏移量
|
|
|
int t = 0;
|
|
|
StringBuilder query2 = new StringBuilder(query);
|