We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26027
    • 145 Posts
    At the recommendation of the developer of our web site, we were instructed to enter the text we used for our resource "title" in the "longtitle" and "description" fields as well.

    The result of having done this is that all our search results show the title twice, side by side. I believe the second instance is really the description.

    We are using the AjaxSearch 1.9.0 snippet and the Search Highlight Plug-In 1.5.

    Can someone please tell me specifically how to change Ajax Search so that it stops printing the description? The duplication with the title is somewhat wearing thin with some people in our organization.

    The developer is long gone and the only solution I know of is to remove the description manually from hundreds of resources.

    Thanks very much for any suggestions how to do this.

    --- Sam (web designer with somewhat weak CMS skills)
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      http://rtfm.modx.com/display/ADDON/AjaxSearch#AjaxSearch-GeneralParameters

      &whereSearch

      Set in which tables & fields the search occurs. (optional)

      tables & fields should be described as:
      table_name[:list_of_field_names][|table_name[:list_of_field_names]]

      The MODx "content_site" table is define as main table. Nick name: content
      "tmplvar_contentvalues" table is defined as a joined table. Nick name: tv
      "jot_content" table is defined as a joined table. Nick name: jot
      "maxigallery" table is defined as joined table. Nick name: maxigallery

      For these AS predefined tables, the fields available for search are the following:

      content:pagetitle,longtitle,description,alias,introtext,menutitle,content
      tv:tv_value
      jot:jot_content
      maxigallery:gal_title,gal_descr,gal_filename

      All these fields are usable for display.
      If you would like use the table for display but not as searchable fields, use the NULL metacharacter. e.g: &whereSearch=`content:NULL|tv`
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 26027
        • 145 Posts
        Susan, thanks for responding. Hard as I tried, I can't understand what you've tried to explain to me. (You tried to explain MODx and AS tables, and that's beyond me.) I really need to be spoonfed. A year ago I needed to modify the search globally so that all search words would be used. I received specific help here which instructed me to go the the configuration file "default.config.php" and change one of the parameters from something like "oneword" to "allwords".

        Is it possible that you could come down (way down) to my level and perhaps provide a change or changes to this same file to do what I need? I studied this file and also studied the installed AjaxSearch snippet. I could be quite incorrect but it seemed that if I modified a couple of the parameters the developer installed, I could get this to work. Some candidates seemed to be:

        $dcfg['whereSearch'] = 'content|tv';
        $dcfg['extract'] = '1:content,description,introtext,tv_value';

        Again, Susan, the search, as installed, works perfectly except for it printing for each result the pagetitle (as a link to the page) and next to it the description (as just text).

        Please don't give up on me ... Sam
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          That was a direct copy of the documentation.

          Put the &whereSearch=`content:...` in the snippet properties, and use a comma-separated list of the fields you want to search. For example &whereSearch=`content:content` will only search the content field.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 26027
            • 145 Posts
            Quote from: sottwell at Jan 19, 2013, 12:49 PM
            That was a direct copy of the documentation.

            Put the &whereSearch=`content:...` in the snippet properties, and use a comma-separated list of the fields you want to search. For example &whereSearch=`content:content` will only search the content field.
            Thanks for staying with me Susan. I looked at the snippet coding and don't have a clue how to put your recommendation into the "snippet properties", unless by "snippet properties" you are referring to the AS configuration file.

            Two questions please:

            1. Can (or 'should') I place the following into the configuration file?
            $dcfg['whereSearch'] = 'content:pagetitle,content|tv:tv_value';
            BTW, my intent is to search the page title and the full text of the resource, and NOT search the long title, description, etc.

            2. This isn't explained anywhere that I could read, but tell me Susan, if we don't include an item in the search (e.g. description, longtitle) will that item also be excluded from the search results display? This is likely the case or you would have mentioned it, but if not, how do I exclude that information from the results?

            Thanks very much ... Sam
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              [[AjaxSearch? &whereSearch=`content:pagetitle,content|tv:my_TV`]]


              This tells it to only search in the site_content table, in the pagetitle field and the content field, as well as in the tmplvar_contentvalues table for a TV named my_TV.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 26027
                • 145 Posts
                Sorry Susan but I couldn't use your code and get it working on my client's MODx. There were different syntax problems each time I tried something new. Here's the present code in the chunk where they do the call to the Search:
                <div id="search"><!--search_terms--><span id="search-txt">SEARCH EDUCATION LAW CENTER</span><a name="search"></a>[!AjaxSearch? &ajaxSearch=`0`  &landingPage=`304` &showResults=`0`!]</div>

                The first time I inserted your code the CMS page partially broke but the search was there and I ran it. Unfortunately it didn't matter because the search results continued to show the description.

                I then inserted it in again and the page didn't break, amazingly, but the search results continue to contain the description.

                Here's that effort:
                <div id="search"><!--search_terms--><span id="search-txt">SEARCH EDUCATION LAW CENTER</span><a name="search"></a>[!AjaxSearch? &whereSearch=`content:pagetitle,content|tv:my_TV` &ajaxSearch=`0`  &landingPage=`304` &showResults=`0`!]</div>
                


                I obviously have no idea why this isn't working. I know you're very skilled with this technology. From everything I've read, Susan, the syntax you've suggested seems to apply only on the search part of the equation where we tell AjaxSearch where (what fields) to search. However it has its mind made up that on the results side of the equation it's still going to place the description. There must be another control somewhere where we tell it to bag the description.

                If you want to abandon this effort at this point, I'll understand. I didn't want to get you this involved and I'm not sure it's even worth it to my client to get rid of the description.

                Thanks ... Sam
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  The TV specified (my_TV) should be the name of a TV that you want searched. If you don't want any TVs to be searched, then leave that part out.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 26027
                    • 145 Posts
                    Susan, I've read many postings on my concern both here in the forums and by using Google. Several people wanted to know how to suppress certain output in the results display. Oddly, this specific question was always avoided and instead the responder explained how to search for terms and NOT how to suppress items on the search's display. It seems you have done the same. Clearly there must be a way but it seems no one wants to talk about it. Very frustrating.

                    To repay you for your effort and for the benefit of others, here's how to remove the resource ID's "description" from the display:

                    Add this item to the appropriate style sheet:
                    /* inserted to make unwanted description text invisible */
                    .ajaxSearch_resultDescription { color: #ffffff }


                    Far from a perfect solution but it my case, if it can't be removed, at least don't let people see it. (Assumption here of course is that white ink makes it invisible)

                    ---- Sam
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      I'm sorry, I thought you wanted to not search the resource's "description" field! So then, all you want to display is the link to the page with the search term. That is, indeed, another matter altogether. Here is the default tpl for individual result items:

                      <div class="[+as.resultClass+]">
                        <a class="[+as.resultLinkClass+]" href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
                      [+as.descriptionShow:is=`1`:then=`
                        <span class="[+as.descriptionClass+]">[+as.description+]</span>
                      `+]
                      [+as.extractShow:is=`1`:then=`
                        <div class="[+as.extractClass+]"><p>[+as.extract+]</p></div>
                      `+]
                      [+as.breadcrumbsShow:is=`1`:then=`
                        <span class="[+as.breadcrumbsClass+]">[+as.breadcrumbs+]</span>
                      `+]
                      </div>

                      Simply create your own chunk tpl without the parts you don't want. Use the &tplResult=`myResultTpl` property to specify your tpl to use.

                      Looking at this tpl, it appears that there should be properties to indicate whether or not the description, extract, and breadcrumb should be displayed in the default template. Only the &breadcrumbs property seems to actually exist, however.
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org