|
8 | 8 | <cfparam name="form.text" default="" /> |
9 | 9 | <cfparam name="form.conditions" default="" /> |
10 | 10 | <cfparam name="form.filters" default="" /> |
11 | | -<cfparam name="form.rawQuery" default="" /> |
| 11 | +<cfparam name="form.rawQuery" default="simple" /> |
| 12 | +<cfparam name="form.queryParser" default="" /> |
12 | 13 | <cfparam name="form.rawFilter" default="" /> |
13 | 14 |
|
14 | 15 | <skin:loadJS id="fc-jquery" /> |
|
54 | 55 | <cfset stArgs["typename"] = form.searchtype /> |
55 | 56 | </cfif> |
56 | 57 | <cfif len(form.text)> |
57 | | - <cfset stArgs["conditions"] = [{ "text"=form.text }] /> |
| 58 | + <cfset stArgs.rawQuery = form.text /> |
58 | 59 | </cfif> |
59 | 60 | <cfset stSearch = application.fc.lib.cloudsearch.search(argumentCollection=stArgs) /> |
60 | 61 | <cfif structKeyExists(stSearch,"conditions")> |
61 | 62 | <cfset form.conditions = application.fapi.formatJSON(serializeJSON(stSearch.conditions)) /> |
62 | 63 | </cfif> |
63 | 64 | <cfset form.rawQuery = stSearch.rawQuery /> |
| 65 | + <cfset form.queryParser = stSearch.queryParser /> |
64 | 66 | <cfif structKeyExists(stSearch,"filters")> |
65 | 67 | <cfset form.filters = application.fapi.formatJSON(serializeJSON(stSearch.filters)) /> |
66 | 68 | </cfif> |
|
82 | 84 | <cfset form.conditions = application.fapi.formatJSON(serializeJSON(stSearch.conditions)) /> |
83 | 85 | </cfif> |
84 | 86 | <cfset form.rawQuery = stSearch.rawQuery /> |
| 87 | + <cfset form.queryParser = stSearch.queryParser /> |
85 | 88 | <cfif structKeyExists(stSearch,"filters")> |
86 | 89 | <cfset form.filters = application.fapi.formatJSON(serializeJSON(stSearch.filters)) /> |
87 | 90 | </cfif> |
|
97 | 100 | <cfset form.text = "" /> |
98 | 101 | <cfset form.conditions = application.fapi.formatJSON(serializeJSON(stSearch.conditions)) /> |
99 | 102 | <cfset form.rawQuery = stSearch.rawQuery /> |
| 103 | + <cfset form.queryParser = stSearch.queryParser /> |
100 | 104 | <cfset form.filters = application.fapi.formatJSON(serializeJSON(stSearch.filters)) /> |
101 | 105 | <cfset form.rawFilter = stSearch.rawFilter /> |
102 | 106 | <cfset form.history = 1 /> |
|
108 | 112 | </ft:processform> |
109 | 113 |
|
110 | 114 | <ft:processform action="Search Raw"> |
111 | | - <cfset stSearch = application.fc.lib.cloudsearch.search(rawQuery=form.rawQuery,rawFilter=form.rawFilter) /> |
| 115 | + <cfset stSearch = application.fc.lib.cloudsearch.search(rawQuery=form.rawQuery, queryParser=form.queryParser, rawFilter=form.rawFilter) /> |
112 | 116 | <cfset form.searchtype = "" /> |
113 | 117 | <cfset form.text = "" /> |
114 | 118 | <cfset form.conditions = "" /> |
115 | 119 | <cfset form.rawQuery = stSearch.rawQuery /> |
| 120 | + <cfset form.queryParser = stSearch.queryParser /> |
116 | 121 | <cfset form.filters = "" /> |
117 | 122 | <cfset form.rawFilter = stSearch.rawFilter /> |
118 | 123 | <cfset form.history = 1 /> |
|
183 | 188 | <br> |
184 | 189 | </cfif> |
185 | 190 |
|
| 191 | + <cfif structKeyExists(searchLog.args,"queryParser")> |
| 192 | + <strong>Query Parser</strong>: <code>#searchLog.args.queryParser#</code> |
| 193 | + <br> |
| 194 | + </cfif> |
| 195 | + |
186 | 196 | <cfif structKeyExists(searchLog.args,"conditions")> |
187 | 197 | <strong>Conditions</strong>: <code class="formatjson">#serializeJSON(searchLog.args.conditions)#</code> |
188 | 198 | <br> |
|
211 | 221 | </div> |
212 | 222 |
|
213 | 223 | <div id="search-conditions" class="<cfif queryTab eq 'conditions'>active</cfif> tab-pane"> |
214 | | - <textarea id="conditions-search" name="conditions" class="span12" rows="5">#form.conditions#</textarea> |
215 | | - <script> |
216 | | - window.conditionsCodeMirror = CodeMirror.fromTextArea(document.getElementById("conditions-search",{"mode":"json"})); |
217 | | - $j("a[href='##search-conditions']").on("shown",function(){ |
218 | | - window.conditionsCodeMirror.refresh(); |
219 | | - }); |
220 | | - </script> |
221 | | - |
222 | | - <textarea id="filters-search" name="filters" class="span12" rows="5">#form.filters#</textarea> |
223 | | - <script> |
224 | | - window.filtersCodeMirror = CodeMirror.fromTextArea(document.getElementById("filters-search",{"mode":"json"})); |
225 | | - $j("a[href='##search-filters']").on("shown",function(){ |
226 | | - window.filtersCodeMirror.refresh(); |
227 | | - }); |
228 | | - </script> |
| 224 | + <ft:field label="Query Parser">structured</ft:field> |
| 225 | + <ft:field label="Conditions"> |
| 226 | + <textarea id="conditions-search" name="conditions" class="span12" rows="5">#form.conditions#</textarea> |
| 227 | + <script> |
| 228 | + window.conditionsCodeMirror = CodeMirror.fromTextArea(document.getElementById("conditions-search",{"mode":"json"})); |
| 229 | + $j("a[href='##search-conditions']").on("shown",function(){ |
| 230 | + window.conditionsCodeMirror.refresh(); |
| 231 | + }); |
| 232 | + </script> |
| 233 | + </ft:field> |
| 234 | + <ft:field label="Filters"> |
| 235 | + <textarea id="filters-search" name="filters" class="span12" rows="5">#form.filters#</textarea> |
| 236 | + <script> |
| 237 | + window.filtersCodeMirror = CodeMirror.fromTextArea(document.getElementById("filters-search",{"mode":"json"})); |
| 238 | + $j("a[href='##search-filters']").on("shown",function(){ |
| 239 | + window.filtersCodeMirror.refresh(); |
| 240 | + }); |
| 241 | + </script> |
| 242 | + </ft:field> |
229 | 243 |
|
230 | 244 | <ft:buttonPanel> |
231 | 245 | <ft:button value="Search Conditions" text="Search" /> |
232 | 246 | </ft:buttonPanel> |
233 | 247 | </div> |
234 | 248 |
|
235 | 249 | <div id="search-raw" class="<cfif queryTab eq 'raw'>active</cfif> tab-pane"> |
236 | | - <textarea id="raw-search-conditions" name="rawQuery" class="span12" rows="5">#form.rawQuery#</textarea> |
237 | | - <textarea id="raw-search-filters" name="rawFilter" class="span12" rows="5">#form.rawFilter#</textarea> |
| 250 | + <ft:field label="Query Parser"> |
| 251 | + <select id="raw-search-parser" name="queryParser" class="span12"> |
| 252 | + <option>simple</option> |
| 253 | + <option>structured</option> |
| 254 | + <option>lucene</option> |
| 255 | + <option>dismax</option> |
| 256 | + </select> |
| 257 | + </ft:field> |
| 258 | + <ft:field label="Query"> |
| 259 | + <textarea id="raw-search-conditions" name="rawQuery" class="span12" rows="5">#form.rawQuery#</textarea> |
| 260 | + </ft:field> |
| 261 | + <ft:field label="Filter"> |
| 262 | + <textarea id="raw-search-filters" name="rawFilter" class="span12" rows="5">#form.rawFilter#</textarea> |
| 263 | + </ft:field> |
238 | 264 |
|
239 | 265 | <ft:buttonPanel> |
240 | 266 | <ft:button value="Search Raw" text="Search" /> |
|
269 | 295 | <div class="tab-content"> |
270 | 296 | <cfif structKeyExists(stSearch,"conditions")> |
271 | 297 | <div id="results-conditions" class="tab-pane"> |
272 | | - <pre class="formatjson">#stSearch.jsonConditions#</pre> |
273 | | - <pre class="formatjson">#stSearch.jsonFilters#</pre> |
| 298 | + <ft:field label="Query Parser">#stSearch.queryParser#</ft:field> |
| 299 | + <ft:field label="Conditions"> |
| 300 | + <pre class="formatjson">#stSearch.jsonConditions#</pre> |
| 301 | + </ft:field> |
| 302 | + <ft:field label="Filter"> |
| 303 | + <pre class="formatjson">#stSearch.jsonFilters#</pre> |
| 304 | + </ft:field> |
274 | 305 | </div> |
275 | 306 | </cfif> |
276 | 307 |
|
277 | 308 | <div id="results-raw" class="tab-pane"> |
278 | | - <pre>#stSearch.rawQuery#</pre> |
279 | | - <pre>#stSearch.rawFilter#</pre> |
| 309 | + <ft:field label="Query Parser">#stSearch.queryParser#</ft:field> |
| 310 | + <ft:field label="Raw Query"> |
| 311 | + <pre>#stSearch.rawQuery#</pre> |
| 312 | + </ft:field> |
| 313 | + <ft:field label="Raw Filter"> |
| 314 | + <pre>#stSearch.rawFilter#</pre> |
| 315 | + </ft:field> |
280 | 316 | </div> |
281 | 317 |
|
282 | 318 | <div id="results-items" class="tab-pane active"> |
|
0 commit comments