Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Oct 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Need to alter search algorithm to only display AND algorithm results

    I am currently working on my new website www.djstractorpartsllc.mybigcommerce.com and the way the site search works is like google using AND, OR & NOT search algorithm and it will make it hard for my customers to find what they are searching for cause it displays results for anything that make each word which in the end makes thousands of results and most are irrelevant to what they would search for. my old site www.djstractorparts.com uses the AND only algorithm i believe. which seems to work best for an eccomerce site. I am looking for a solution to either alter the code within bigcommerce or add some code that forces the server to tie all words together instead of breaking them apart for the results.

    heres some of the code:
    Code:
    <div id="SearchForm">
    
        <form onsubmit="return check_small_search_form()" method="get" action="http://djstractorpartsllc.mybigcommerce.com/search.php">
            <label for="search_query"> … </label>
            <input id="search_query" class="Textbox pb_payload" type="text" value="" name="search_query" autocomplete="off"></input>
            <input class="Button" type="image" src="http://cdn1.bigcommerce.com/r175e9b162a6cfc6d9f37bac4def0e7ae1aca1c4a/templates/Bodybuilding/images/orange/Search.gif"></input>
        </form>
        <p> … </p>

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Post your processing code relevant to the construction of the query conditions. A form is meaningless without the instructions for it.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    New to the CF scene
    Join Date
    Oct 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    Post your processing code relevant to the construction of the query conditions. A form is meaningless without the instructions for it.
    Oh sorry heres some code
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
    I'm not 100% sure what code you need so I'm going to post a few
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    %%Panel.HTMLHead%%
    <body>
        <div id="Container">
        %%Panel.Header%%
    
        <div id="Wrapper">
            %%Panel.WrapperBanner%%
            <div class="Left" id="LayoutColumn1">
                %%Panel.SideCategoryList%%
                %%Panel.SideShopByBrand%%
                %%Panel.SideNewsletterBox%%
            </div>
            <div class="Content Wide WideWithLeft" id="LayoutColumn2">
                %%Panel.SearchPageHeader%%
                %%Banner.TopBanner%%
                %%Panel.SearchPage%%
                %%Banner.BottomBanner%%
            </div>
            <br class="Clear" />
        </div>
        %%Panel.Footer%%
    </div>
    
    </body>
    </html>
    Code:
                <div id="SearchForm">
                    <form action="%%GLOBAL_ShopPath%%/search.php" method="get" onsubmit="return check_small_search_form()">
                        <label for="search_query">%%LNG_Search%%</label>
                        <input type="text" name="search_query" id="search_query" class="Textbox" value="%%GLOBAL_OriginalSearchQuery%%" />
                        <input type="image" src="%%GLOBAL_IMG_PATH%%/%%GLOBAL_SiteColor%%/Search.gif" class="Button" />
                    </form>
                    <p>
                        <a href="%%GLOBAL_ShopPathNormal%%/search.php?mode=advanced"><strong>%%LNG_AdvancedSearch%%</strong></a> |
                        <a href="%%GLOBAL_ShopPathNormal%%/search.php?action=Tips">%%LNG_SearchTips%%</a>
                    </p>
                </div>
    
                <script type="text/javascript">
                    var QuickSearchAlignment = 'left';
                    var QuickSearchWidth = '232px';
                    lang.EmptySmallSearch = "%%LNG_EmptySmallSearch%%";
                </script>

  • #4
    New to the CF scene
    Join Date
    Oct 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the only thing Ive been able to find is GET / HTTP/1.1 using web sniffer

  • #5
    New to the CF scene
    Join Date
    Oct 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Get / http/1.1 200 ok

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    You'll need to post the code that relates to the searching in use. All of this is HTML and some type of (probably) template engine.
    This is the script you'd need to post: http://djstractorpartsllc.mybigcommerce.com/search.php, although given the absolute url I'd question if its a local script.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #7
    New to the CF scene
    Join Date
    Oct 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the php was created by bigcommerce and us users have no way to alter the code so i need a work around to force the search to work the way I'd like. The only code i could find was by viewing the page source for http://djstractorpartsllc.mybigcommerce.com/search.php

    PHP Code:
    //<![CDATA[    
        
    $(document).ready(function() {
            $(
    '.ToggleSearchFormLink').css('visibility''visible');

            $(
    "#category").jstree({
                
    json_data: {
                    
    data: [
                        [{
    "data":"ALLIS CHALMERS","attr":{"id":"category-4598","title":"ALLIS CHALMERS"},"metadata":{"id":4598},"state":"closed"},{"data":"CASE","attr":{"id":"category-4658","title":"CASE"},"metadata":{"id":4658},"state":"closed"},{"data":"COCKSHUTT","attr":{"id":"category-4662","title":"COCKSHUTT"},"metadata":{"id":4662},"state":"closed"},{"data":"FORD","attr":{"id":"category-4664","title":"FORD"},"metadata":{"id":4664},"state":"closed"},{"data":"INTERNATIONAL \/ FARMALL","attr":{"id":"category-4668","title":"INTERNATIONAL \/ FARMALL"},"metadata":{"id":4668},"state":"closed"},{"data":"JOHN DEERE","attr":{"id":"category-4681","title":"JOHN DEERE"},"metadata":{"id":4681},"state":"closed"},{"data":"MASSEY FERGUSON \/ HARRIS","attr":{"id":"category-4676","title":"MASSEY FERGUSON \/ HARRIS"},"metadata":{"id":4676},"state":"closed"},{"data":"MINNEAPOLIS MOLINE \/ AVERY","attr":{"id":"category-4671","title":"MINNEAPOLIS MOLINE \/ AVERY"},"metadata":{"id":4671},"state":"closed"},{"data":"WHITE \/ OLIVER","attr":{"id":"category-4615","title":"WHITE \/ OLIVER"},"metadata":{"id":4615},"state":"closed"}]
                    ],
                    
    ajax: {
                        
    url"remote.php?w=getChildCategoriesJSON",
                        
    data: function (n) {
                            var 
    selectedCategoryId 0;
                            if (
    n.attr) {
                                
    selectedCategoryId n.data('id');
                            }

                            var 
    data = {
                                
    selectedCategoryIdselectedCategoryId,
                                
    prefix'category'
                            
    };

                            return 
    data;
                        },
                        global: 
    false
                    
    }
                },
                
    ui: {
                    
                },
                
    themes: {
                    
    theme"interspire",
                    
    urlconfig.ShopPath '/javascript/jquery/plugins/jstree/themes/interspire/style.css'
                
    },
                
    checkbox: {
                    
    two_statetrue,
                    
    override_uitrue,
                    
    real_checkboxestrue,
                    
    real_checkboxes_names: function(n) {
                        return [
    "category[]"n.data('id')];
                    }
                },
                
    plugins: [ "themes""json_data""ui""checkbox" ]
            });

            if(
    "" == "true") {
                
    ToggleSearchForm();
            }
        });

        
    // Toggle the advanced search form
        
    function ToggleSearchForm() {
            if($(
    '.AdvancedSearch').css('display') == 'none') {
                $(
    '.AdvancedSearch').show();
                $(
    '#toggle_form_image').attr({src:"http://cdn1.bigcommerce.com/r5ac02ab387cc3aebbe977dd7e4ef167e71be1d62/templates/Bodybuilding/images/ArrowUp.gif"});
                $(
    '#toggle_form_link').text('Hide Search Form');
                $(
    '#search_query_adv').focus();
            }
            else {
                $(
    '.AdvancedSearch').hide();
                $(
    '#toggle_form_image').attr({src:"http://cdn1.bigcommerce.com/r5ac02ab387cc3aebbe977dd7e4ef167e71be1d62/templates/Bodybuilding/images/ArrowDown.gif"});
                $(
    '#toggle_form_link').text('Show Search Form');
            }
        }

        function 
    showSearchTabs(section)
        {
            var 
    showSectionhideSection;

            if (
    typeof(section) == 'undefined' || (section.toLowerCase() !== 'product' && section.toLowerCase() !== 'content')) {
                return;
            }

            if (
    section.toLowerCase() == 'product') {
                
    showSection 'Product';
                
    hideSection 'Content';
            } else {
                
    showSection 'Content';
                
    hideSection 'Product';
            }

            $(
    '#Search' showSection '_Tab').attr('class''Active');
            $(
    '#Search' showSection '_Container').show();
            $(
    '#Search' hideSection '_Tab').attr('class''');
            $(
    '#Search' hideSection '_Container').hide();
        }

        function 
    AjaxSearchPagingClick()
        {
            var 
    parent = $(this).parents('.SearchContainer');

            var 
    url this.href;
            
    url url.replace(/#.*$/, '');

            
    url += '&ajax=1';

            $(
    this).parents('.SearchContainer').load(url, {}, function() {
                
    BindAjaxSearch();
            });

            return 
    false;
        }

        function 
    AjaxSearchSortingChange()
        {
            var 
    url location.pathname;
            var 
    search location.search.substr(1).split('&');

            for (var 
    search.lengthi--;) {
                
    // remove existing values that we'll overwrite later
                
    if (/^(sortby|section|ajax)=/i.test(search[i])) {
                    
    search.splice(i1);
                }
            }

            
    search.push('ajax=1');
            
    search.push('sortBy=' encodeURIComponent($(this).val()));

            var 
    id = $(this).attr('id');

            if (
    id.toLowerCase().indexOf('product') !== -1) {
                
    search.push('section=product');
            } else {
                
    search.push('section=content');
            }

            
    search search.join('&');

            
    url += '?' search;

            $(
    this).parents('.SearchContainer').load(url, {}, BindAjaxSearch);

            return 
    false;
        }

        function 
    BindAjaxSearch()
        {
            
    // onchange is not currently supported by live/die so this needs to be run whenever the search results dom changes
            
    $('.CategoryPagination a').click(AjaxSearchPagingClick);
            $(
    '.SearchSortingList').change(AjaxSearchSortingChange);
            
    window.scrollTo(00);
            
    setProductListHeights();
        }

        $(
    document).ready(function() {
            
    BindAjaxSearch();
        });

        
    // Make sure any advanced search fields are valid
        
    function CheckAdvancedSearchForm() {
            if($(
    '#search_query_adv').val() == '') {
                
    alert('You forgot to enter some search keywords.');
                $(
    '#search_query_adv').focus();
                return 
    false;
            }

            if(
    isNaN($('#price_from').val())) {
                
    alert('Please enter a valid \'from\' price containing numbers only.');
                $(
    '#price_from').focus();
                $(
    '#price_from').select();
                return 
    false;
            }

            if(
    isNaN($('#price_to').val())) {
                
    alert('Please enter a valid \'to\' price containing numbers only.');
                $(
    '#price_to').focus();
                $(
    '#price_to').select();
                return 
    false;
            }

            var 
    form = $('#AdvancedSearchForm');

            
    // disable redundant fields
            
    var disabled = [];

            
    form.find('[name]').each(function(){
                if (
    typeof this.disabled === 'undefined' || this.disabled) {
                    
    // skip elements that can't be disabled, or are already disabled
                    
    return;
                }

                if (
    this.name.substr(020) != 'ISSelectReplacement_') {
                    
    // these aren't the fields you're looking for
                    
    return;
                }

                
    disabled.push(this);
                
    this.disabled true;
            });

            if (
    disabled.length) {
                
    // fields were disabled need to be re-enabled so that using the back button doesn't result in a form with disabled fields
                // needs to be a timeout so the fields are re-enabled after the form is dispatched
                
    window.setTimeout(function(){
                    for (var 
    disabled.lengthi--;) {
                        
    disabled[i].disabled false;
                    }
                }, 
    1);
            }

            return 
    true;
        }

        
    // Track a search click
        
    $(document).ready(function()
        {
            $(
    '.TrackLink').mousedown(function(event)
            {
                
    // Only care for left clicks
                
    if(event.button && event.button != 1)
                {
                    return;
                }

                
    isc_TrackSearchClick('');
            });
        });
    //]]> 


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •