Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author websupporter

    (@websupporter)

    Hi Andy,
    no, its supposed to work. What exactly is the problem and the settings? I’ve checked a bit into the fulltext search since I was optimizing it for the next premium version.

    If you get double results, please replace the function sf_content_filter in the file profi-search-filter.php with the following code:

    function sf_content_filter( $sf_where, &$wp_query ){
            global $wpdb;
    
    		if( $wp_query->get( 'sf-title' ) || $wp_query->get( 'sf-meta' ) || $wp_query->get( 'sf-content' )  || $wp_query->get( 'sf-excerpt' ) ):
    
    			$concat_fields = array();
    
    			$st = $wp_query->get( 'sf-title' );
    			if( isset( $st ) && !empty( $st ) ):
    				$concat_fields[] = $wpdb->posts . '.post_title';
    				$search_term = $st;
    			endif;
    
    			$st = $wp_query->get( 'sf-content' );
    			if( isset( $st ) && !empty( $st ) ):
    				$concat_fields[] = $wpdb->posts . '.post_content';
    				$search_term = $st;
    			endif;
    
    			$st = $wp_query->get( 'sf-excerpt' );
    			if( isset( $st ) && !empty( $st ) ):
    				$concat_fields[] = $wpdb->posts . '.post_excerpt';
    				$search_term = $st;
    			endif;
    
    			$metas = $wp_query->get( 'sf-meta' );
    			$post_meta_keys = array();
    			if( isset( $metas ) && is_array( $metas ) && count( $metas ) > 0 ){
    				foreach( $wp_query->get( 'sf-meta' ) as $meta => $search_term ){
    					preg_match( '^meta\[(.*)\]^', $meta, $match );
    					$concat_fields[] = md5( $meta ) . '.meta_value';
    					$post_meta_keys[ md5( $meta ) ] = $match[1];
    				}
    			}
    
    			$concat_string = '';
    			foreach( $concat_fields as $f ):
    				$concat_string .= ',' . $f . ', " "';
    			endforeach;
    			$sf_add_where = '';
    
    			if( !empty( $concat_string ) ):
    				$sf_add_where = ' AND (';
    				$concat_string = "CONCAT( \"\" " . $concat_string . ") LIKE '%" . esc_sql( like_escape( $search_term ) ) . "%' ";
    				$sf_add_where .= $concat_string;
    				$sf_add_where .= ' ) ';
    				if( count( $post_meta_keys ) > 0 ):
    					foreach( $post_meta_keys as $key => $val ):
    						$sf_add_where .= " AND " . $key . ".meta_key ='" . $val . "'";
    					endforeach;
    				endif;
    			endif;
    			$sf_where .= $sf_add_where;
    		endif;
    
    		return $sf_where;
    	}

    This code will be soon also in the premium version and I will update the free version as soon as possible.

    I hope, this solves your problem.

    Thread Starter andy_woz

    (@andy_woz)

    Nope not duplicate results, no results.

    Thread Starter andy_woz

    (@andy_woz)

    I’m just not getting any results, even if I search on terms that are in select options (they are checked off for keywords too).

    Does this help:

    Full text url string:
    /profi-search/#sf-{"1":"North%20Yarmouth","search-id":"1"}

    Select menu text url string:
    /profi-search/#sf-{"2":"North%20Yarmouth","search-id":"1"}

    To get any results I need to clear the full text search first. the meta field that the query belongs to is set for both select menu search and keyword.

    Any ideas?

    Plugin Author websupporter

    (@websupporter)

    Hi andy,
    it would be great, if you could send me the link. Even better the admin credentials.

    please contact me via here.

    thanks a lot.

    Thread Starter andy_woz

    (@andy_woz)

    Sent email + deets, thanks!

    A

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Text search’ is closed to new replies.