Skip to content

Instantly share code, notes, and snippets.

View eedeebee's full-sized avatar

Eric Bloch eedeebee

  • Hillsborough, CA
View GitHub Profile
@eedeebee
eedeebee / manifest.json
Created March 29, 2022 20:06 — forked from greatghoul/manifest.json
Chrome Extension Sample - detect if an extension is installed.
{
"name": "Detect if an extension installed",
"description": "Detect if an extension installed",
"version": "0.1",
"manifest_version": 2,
"permissions": [
"management"
],
"browser_action": {
"default_popup": "popup.html"
@eedeebee
eedeebee / mlcp-example-1.sh
Last active September 20, 2016 08:11
MarkLogic Content Pump Examples
mlcp.sh import \
-host localhost \
-port 8006 \
-username user \
-password ******* \ 
-input_file_path /data/latest
for $speech in (doc()//SPEECH)[1 to 100]
let $speaker := $speech/SPEAKER
let $lines := $speech/LINE
return (
<h2>{$speaker/text()}</h2>,
<p>{for $line in $lines return $line/text()}</p>
)
{
"options": {
"debug": false,
"transform-results": {
"apply": "raw"
},
"constraint": [{
"name": "stars",
"range": {
"type": "xs:int",
@eedeebee
eedeebee / grouping.xqy
Created January 7, 2014 17:39
Grouping the values from a range index
xquery version "1.0-ml";
declare namespace sample = "http://marklogic.com/sample";
let $groupsize := 1000
let $values := cts:element-values(xs:QName("sample:value"))
let $count := fn:count($values)
let $groups :=
for $i in (0 to (xs:int($count div $groupsize) + 1))
let $group := $values[(($i * $groupsize) + 1) to (($i + 1) * $groupsize)]
return fn:string-join($group, "|")
@eedeebee
eedeebee / tweet_options.xml
Created January 3, 2014 22:11
Search options for tweet and telephone fields, with suggestion source
<options xmlns="http://marklogic.com/appservices/search">
<search-option>unfiltered</search-option>
<quality-weight>0</quality-weight>
<return-plan>true</return-plan>
<debug>true</debug>
<constraint name="tweet">
<word>
<field name="tweet"/>
</word>
</constraint>
@eedeebee
eedeebee / tweet_options.xml
Last active January 2, 2016 03:59
Search options for fields with tweet and telephone #s
<options xmlns="http://marklogic.com/appservices/search">
<search-option>unfiltered</search-option>
<quality-weight>0</quality-weight>
<return-plan>true</return-plan>
<debug>true</debug>
<constraint name="tweet">
<word>
<field name="tweet"/>
</word>
</constraint>
@eedeebee
eedeebee / tweet_options.xml
Created January 3, 2014 21:53
Search options with word field constraint
<options xmlns="http://marklogic.com/appservices/search">
<search-option>unfiltered</search-option>
<quality-weight>0</quality-weight>
<return-plan>true</return-plan>
<debug>true</debug>
<constraint name="tweet">
<word>
<field name="tweet"/>
</word>
</constraint>
@eedeebee
eedeebee / setup1.xqy
Last active January 2, 2016 03:49
Setup scripts for MarkLogic custom tokenization tutorial at http://developer.marklogic.com/learn/custom-tokenization
xquery version "1.0-ml";
(: Create the database and forest on current host :)
import module namespace admin="http://marklogic.com/xdmp/admin"
at "/MarkLogic/admin.xqy";
let $config := admin:get-configuration()
let $config :=
admin:database-create($config, "tweets",
xdmp:database("Security"), xdmp:database("Schemas"))
let $config := admin:forest-create($config, "tweetsF1", xdmp:host(), ())
<search:plan>
<qry:query-plan xmlns:qry="http://marklogic.com/cts/query">
<qry:info-trace>xdmp:value("xdmp:plan(cts:search(fn:collection(),cts:query($query),$options,...")</qry:info-trace>
<qry:info-trace>Analyzing path for search: fn:collection()</qry:info-trace>
<qry:info-trace>Step 1 is searchable: fn:collection()</qry:info-trace>
<qry:info-trace>Path is fully searchable.</qry:info-trace>
<qry:info-trace>Gathering constraints.</qry:info-trace>
<qry:field-word-trace text="@NASA" field-name="tweet">
<qry:key>12422997346279939379</qry:key>
</qry:field-word-trace>