We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24495
    • 407 Posts
    I try to set up a search form with AS 1.8 (non-ajax). Searching the word "Rom" finds documents without this word in content and/or TVs but with an included eform (finds the from parameter). The eform call itself is included in a TV (is this the problem?).

    Filtering all documents with forms by
    &filter=`id,XXX,2`

    doesn’t work (of course XXX is the id of the document grin ).

    AS also extracts cutted paths to content in assets/images or assets/files. Is it possible to hide such extracts?

    And it seems that rank and order fail too. I set (at search result page) this:
    &rank=`pagetitle:100` &order=`pagetitle DESC`


    Please try yourself at this test page: http://www.koegel-touristik.de/suche/index.html with the search term "Rom".
    Why I get 1 result at page 1 and two results at page 2? And why I get the result "Bus-Charter" at page 3? There isn’t "Rom" or "rom" at this page (but an eform with "from" parameter).

    For better analysing here the results snippet
    [!ajaxSearch? &ajaxSearch=`0` &AS_landing=`295` &AS_showForm=`0` &AS_showResults=`1` &minChars=`3`  &addJscript=`0` &language=`german` &tplResult=`sformResult` &tplResults=`sformResults` &tplPaging=`sformPaging` &pageLinkSeparator=` | ` &extract=`1` &rank=`pagetitle:100` &order=`pagetitle DESC`!]

    and the search snippet itself
    [[ajaxSearch? &ajaxSearch=`0` &AS_landing=`295` &AS_showForm=`1` &AS_showResults=`0` &minChars=`3`  &addJscript=`0` &language=`german` &tplLayout=`sform`]]

    Maybe I doesn’t understand AjaxSearch and AS parameters correctly?
      • 5811
      • 1,717 Posts
      And it seems that rank and order fail too. I set (at search result page) this:
      &rank=`pagetitle:100` &order=`pagetitle DESC`
      It runs but partially grin. I have noticed that the ranking is correct but the order (for a same level of ranking) is breaking by the application of the ranking function. All the results for a same rank are sorted not on pageTitle but on the id of the document. I have reproduced this issue on my own environment.
      Unfortunately, the correction is not obvious. So until the version 1.8.1, for a correct display, I suggest you to keep &order=’pageTitle DESC’ but set &rank=``. This will unset the ranking function (otherwise by default: &rank=`pagetitle:100,extract`).

      Regarding the results, keep in mind that the seach terms are searched in the following fields:
      pagetitle, longtitle, description, alias, introtext, menutitle, content,tv_content. So regarding the result "Bus-Charter" at page 3, may be one of these fields contains "Rom". Thanks to check it.

      To undertsand why you get 1 result at page 1 and two results at page 2, I need to have the content of fields used to set up the extract. For that I will contact you by PM.
        • 24495
        • 407 Posts
        Thanks coroico but it doesn’t helped. I tried &order=`pagetitle DESC` and &rank=`` (with and without a blank between backticks) and I can’t understand the result. Searching "Rom" give back the first pagetitle with "Rom" at 10th place, the other results at page 2. There must be another "hidden" ranking algorithm overlaying the order clause.

        To understand the content of the travel pages here the field descriptions:
        - content: contains only the travel description (1st day to last day)
        - all other page content is saved in different TVs (photo / included benefits / prices / travel dates / etc)

        The "Bus-Charter" result found with rom/Rom search term is probably an issue with a TV. I try to explain:
        All templates have a TV called "contentScript" used for non-richtext input of snippet calls e.g. eform. This TV is exclusive for admins, my client (as restricted user) editing this page can’t edit or set input here.
        The template itself has this (partial) construction:
        <div id="maincontent">
        [*longtitle*]
        [*content*]
        [*contentScript*]
        </div>

        So I can publish some richtext content and (if needed) after that a snippet call (in this case the eform snippet call for bus charter enquiries). It seems that AS find the eform call in the "contentScript" TV and takes the text of the call as a possible result. Therefore "Bus-Charter" is a result of searching "rom" (or "Rom" also) because the "from" clause is the single "...rom..." text in all fields of this document.
        AS should ignore all snippet and chunk calls in content as well as in TVs. Seems it doesn’t do that.
          • 5811
          • 1,717 Posts
          Searching "Rom" give back the first pagetitle with "Rom" at 10th place, the other results at page 2
          With &order=`pagetitle DESC` &rank=`` you only sort the documents found by the titlepage. So it could be normal that "Rom" appears at the 10th place. But results should be ordered by descendant alphabetical order of titlepage.

          I have added "with order and without ranking" demo as example. Use "school" for instance as seachterm. Results are ordered by pagetitle (DESC order).
            • 24495
            • 407 Posts
            You’re right. Hope I understand now the interaction between order and rank:
            - without rank I get all documents containing "rom" ordered by pagetitle (independent of containing "rom" in pagetitle)
            - WITH additional rank (if it works correct) and ranked by pagetitle: get I the docs containing "Rom" in pagetitle as first results? Or what is the order now?

            I think that a user searching for "Rom" would see first all documents containing travel to all italian targets with Rom. I know that this is a special example because of "rom" is included in many words.

            Reading other threads (http://modxcms.com/forums/index.php/topic,28667.0.html) and trying other search terms I also think that it would be nice to filter/exclude TVs by their name.
              • 25663 MODX Staff
              • 12,272 Posts
              Explicitly excluding or including TVs to search would be quite welcome indeed. Would make it simple to create function-specific searches faster.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 5811
                • 1,717 Posts
                In the version 1.8.1 currently in progress, the &whereSearch parameter is improved by adding the list of fields where to do the search

                e.g: &whereSearch=`content:pagetitle,introtext|tv:tv_value|maxigallery:gal_title`

                by default by default = "content|tv" allow the search in all the fields of content and tv values.


                and the list of Tvs used by the search defined by the &withTvs parameter.

                e.g: &withTvs=`+:tv1,tv5,tv8` use only tv1,tv5,tv8 for the search (&whereSearch)
                e.g: &withTvs=`-:tv1,tv5,tv8` all tvs except tv1, tv5,tv8 are used

                And in any case, all the data fields of the tables used will be available as placeholder for the display in templates.

                [EDIT: Registered as ADDON-24]
                  • 24495
                  • 407 Posts
                  "Applause, applause, applause" (Kermit the frog grin) Nice to read this.

                  And another question: if I use a custom &tplResults the highlighting span in the results list (in extract texts) is missing. Why this? If I delete the &tplResults parameter it is back. Forget it, my mistake rolleyes
                    • 25663 MODX Staff
                    • 12,272 Posts
                    That’s awesome coroico! laugh
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 24495
                      • 407 Posts
                      I know that I’m a pain in the neck grin

                      Searching a word with or without first capital letter ever finds all results with this word, e.g. searching "Berlin" or "berlin" gives back same results.
                      But: the highlighting span in extracts marks only the version typed in search form. Searching "berlin" marks only "berlin" in the results list but additionally shows all other results with unmarked "Berlin". Is there a way to adapt the search class marking both versions found and extracted?