@@ -400,27 +400,28 @@ component {
400400
401401 csdClient = getClient (" domain" , arguments .domain );
402402
403+ // collect index field information
404+ if (structKeyExists (arguments ," typename" ) and len (arguments .typename )){
405+ // filter by content type
406+ if (listlen (arguments .typename )){
407+ for (key in listtoarray (arguments .typename )){
408+ structAppend (stIndexFields , getTypeIndexFields (key ));
409+ }
410+ }
411+ else {
412+ stIndexFields = getTypeIndexFields (arguments .typename );
413+ }
414+ }
415+ else {
416+ stIndexFields = getTypeIndexFields ();
417+ }
418+
403419 // create query
404420 if (not structKeyExists (arguments ," rawQuery" )){
405421 if (not structKeyExists (arguments ," conditions" )){
406422 arguments .conditions = [];
407423 }
408424
409- if (structKeyExists (arguments ," typename" ) and len (arguments .typename )){
410- // filter by content type
411- if (listlen (arguments .typename )){
412- for (key in listtoarray (arguments .typename )){
413- structAppend (stIndexFields , getTypeIndexFields (key ));
414- }
415- }
416- else {
417- stIndexFields = getTypeIndexFields (arguments .typename );
418- }
419- }
420- else {
421- stIndexFields = getTypeIndexFields ();
422- }
423-
424425 st = getSearchQueryFromArray (stIndexFields = stIndexFields , conditions = arguments .conditions , bBoost = true );
425426 arguments .rawQuery = st .query ;
426427 arguments .queryParser = st .parser ;
@@ -451,7 +452,7 @@ component {
451452 }
452453
453454 if (arraylen (arguments .filters )){
454- arguments .rawFilter = getSearchQueryFromArray (stIndexFields = stIndexFields , conditions = arguments .filters , bBoost = false );
455+ arguments .rawFilter = getSearchQueryFromArray (stIndexFields = stIndexFields , conditions = arguments .filters , bBoost = false ). query ;
455456
456457 if (arraylen (arguments .filters ) gt 1 ){
457458 arguments .rawFilter = " (and " & chr (10 ) & arguments .rawFilter & chr (10 ) & " )" ;
@@ -701,7 +702,7 @@ component {
701702 return dateformat (asUTC ," yyyy-mm-dd" ) & " T" & timeformat (asUTC ," HH:mm:ss" ) & " Z" ;
702703 }
703704
704- public string function getSearchQueryFromArray (required struct stIndexFields , required array conditions , boolean bBoost = true , numeric indent = 1 ){
705+ public struct function getSearchQueryFromArray (required struct stIndexFields , required array conditions , boolean bBoost = true , numeric indent = 1 ){
705706 var item = {};
706707 var arrOut = [];
707708
@@ -719,22 +720,22 @@ component {
719720 }
720721 else if (structKeyExists (item ," and" )) {
721722 if (arraylen (item [" and" ]) gt 1 ){
722- arrayAppend (arrOut ,repeatstring (" " ,arguments .indent ) & " (and " & chr (10 ) & getSearchQueryFromArray (stIndexFields = arguments .stIndexFields , conditions = item [" and" ], bBoost = arguments .bBoost , indent = indent + 1 ) & chr (10 ) & repeatstring (" " ,arguments .indent ) & " )" );
723+ arrayAppend (arrOut ,repeatstring (" " ,arguments .indent ) & " (and " & chr (10 ) & getSearchQueryFromArray (stIndexFields = arguments .stIndexFields , conditions = item [" and" ], bBoost = arguments .bBoost , indent = indent + 1 ). query & chr (10 ) & repeatstring (" " ,arguments .indent ) & " )" );
723724 }
724725 else {
725- arrayAppend (arrOut ,getSearchQueryFromArray (stIndexFields = arguments .stIndexFields , conditions = item [" and" ], bBoost = arguments .bBoost , indent = indent + 1 ));
726+ arrayAppend (arrOut ,getSearchQueryFromArray (stIndexFields = arguments .stIndexFields , conditions = item [" and" ], bBoost = arguments .bBoost , indent = indent + 1 ). query );
726727 }
727728 }
728729 else if (structKeyExists (item ," or" )) {
729730 if (arraylen (item [" or" ]) gt 1 ){
730- arrayAppend (arrOut ,repeatstring (" " ,arguments .indent ) & " (or " & chr (10 ) & getSearchQueryFromArray (stIndexFields = arguments .stIndexFields , conditions = item [" or" ], bBoost = arguments .bBoost , indent = indent + 1 ) & chr (10 ) & repeatstring (" " ,arguments .indent ) & " )" );
731+ arrayAppend (arrOut ,repeatstring (" " ,arguments .indent ) & " (or " & chr (10 ) & getSearchQueryFromArray (stIndexFields = arguments .stIndexFields , conditions = item [" or" ], bBoost = arguments .bBoost , indent = indent + 1 ). query & chr (10 ) & repeatstring (" " ,arguments .indent ) & " )" );
731732 }
732733 else {
733- arrayAppend (arrOut ,getSearchQueryFromArray (stIndexFields = arguments .stIndexFields , conditions = item [" or" ], bBoost = arguments .bBoost , indent = indent + 1 ));
734+ arrayAppend (arrOut ,getSearchQueryFromArray (stIndexFields = arguments .stIndexFields , conditions = item [" or" ], bBoost = arguments .bBoost , indent = indent + 1 ). query );
734735 }
735736 }
736737 else if (structKeyExists (item ," not" )) {
737- arrayAppend (arrOut ,repeatstring (" " ,arguments .indent ) & " (not " & chr (10 ) & getSearchQueryFromArray (stIndexFields = arguments .stIndexFields , conditions = item [" not" ], bBoost = arguments .bBoost , indent = indent + 1 ) & chr (10 ) & repeatstring (" " ,arguments .indent ) & " )" );
738+ arrayAppend (arrOut ,repeatstring (" " ,arguments .indent ) & " (not " & chr (10 ) & getSearchQueryFromArray (stIndexFields = arguments .stIndexFields , conditions = item [" not" ], bBoost = arguments .bBoost , indent = indent + 1 ). query & chr (10 ) & repeatstring (" " ,arguments .indent ) & " )" );
738739 }
739740 }
740741
0 commit comments