-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolr.ps1
21 lines (19 loc) · 932 Bytes
/
solr.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$solrProperties = @{
"solrHost" = "http://localhost:8080/solr/"
};
function solr () {
$host = $solrProperties.Get_Item("solrHost");
$query = $args[0];
if($query.equals("-clean")) {
curl http://localhost:8080/solr/update/?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
} elseif($query.equals("-full")) {
curl "http://localhost:8080/solr/admin/dataimport?command=full-import&verbose" | sed -e 's/<[^<]*>/ /g'
} elseif($query.equals("-delta")) {
curl "http://localhost:8080/solr/admin/dataimport?command=delta-import&verbose" | sed -e 's/<[^<]*>/ /g'
} elseif($query.equals("-status")) {
curl "http://localhost:8080/solr/admin/dataimport" | sed -e 's/</\n</g' | grep 'str'
} else{
echo "http://localhost:8080/solr/select/?q=$query&indent=on&wt=json"
curl "http://localhost:8080/solr/select/?q=$query&indent=on&wt=json"
}
}