+=head2 _build_initial_query
+
+ ($query, $query_cgi, $query_desc, $previous_operand) = _build_initial_query($initial_query_params);
+
+ Build a section of the initial query containing indexes, operators, and operands.
+
+=cut
+
+sub _build_initial_query {
+ my ($params) = @_;
+
+ my $operator = "";
+ if ($params->{previous_operand}){
+ #If there is a previous operand, add a supplied operator or the default 'and'
+ $operator = ($params->{operator}) ? " ".($params->{operator})." " : ' and ';
+ }
+
+ #NOTE: indexes_set is typically set when doing truncation or field weighting
+ my $operand = ($params->{indexes_set}) ? $params->{parsed_operand} : $params->{index_plus}.$params->{parsed_operand};
+
+ #e.g. "kw,wrdl:test"
+ #e.g. " and kw,wrdl:test"
+ $params->{query} .= $operator . $operand;
+
+ $params->{query_cgi} .= "&op=".uri_escape($operator) if $operator;
+ $params->{query_cgi} .= "&idx=".uri_escape($params->{index}) if $params->{index};
+ $params->{query_cgi} .= "&q=".uri_escape($params->{original_operand}) if $params->{original_operand};
+
+ #e.g. " and kw,wrdl: test"
+ $params->{query_desc} .= $operator . $params->{index_plus} . " " . $params->{original_operand};
+
+ $params->{previous_operand} = 1 unless $params->{previous_operand}; #If there is no previous operand, mark this as one
+
+ return ($params->{query}, $params->{query_cgi}, $params->{query_desc}, $params->{previous_operand});
+}
+