New Community Forums are coming. Watch this space for news.
Subscribe: RSS
  • Awesome, it works! Thank you so much smiley
    • Hi, it’s me once more. I still don’t get it running as I wish.

      This is the snippet call on my landing page:

      [!AjaxSearch? &ajaxSearch=`0` &parents=`in:2,11` &showInputForm=`0` &showResults=`1` &tplResult=`tplResult` &pagingType=`0` &tplResults=`tplResults` &tplGrpResult=`tplGrpResult` &language=`(yams_mname)` &grabMax=`10` &extract=`1:tv_value` &withTvs=`+:content_(yams_id),description_(yams_id),introtext_(yams_id),longtitle_(yams_id),menutitle_(yams_id),pagetitle_(yams_id)`!]

      The tplResult looks like
      <div class="[+as.resultClass+]">
      <a class="[+as.resultLinkClass+]" href="(yams_doc:[])" title="[+as.longtitle+]">[[YAMS? &get=`content` &from=`pagetitle` &docid=`[]`]]</a>
        <span class="[+as.descriptionClass+]">[+as.description+]</span>
        <div class="[+as.extractClass+]"><p>[+as.extract+]</p></div>
        <div class="[+as.breadcrumbsClass+]">[+as.breadcrumbs+]</div>

      This should be the code proposed by Fil DOrc in the original post.

      I get the following result (using a bi-lingual website in english and german):

      The page titles of the found pages are output in the correct language. But the extracts are in random language. I can see no pattern for it. I just had a idea, but it is not correct: The website is still being filled with content, and there are many pages with german content but no english content yet. My idea was that there would always be shown the correct language (testing mainly with german) but if it is not available, the extract would fall back to the other language. But this is not true. And now as I am typing I am wondering how the mono-lingual AjaxSearch could have a buil-it fall-back ...

      Does anybody have any idea?
      • Hi FuryDE.

        Regarding the extracts: I *think* that the way your AjaxSearch call is currently set up it will search within the standard document variables and the template variables of the current language. So perhaps it is sometimes matching on content in a standard document variable (which is in one language) and sometimes matching on a template variable (which could be in another)? Perhaps you could prevent AjaxSearch from searching within standard document variables by using something like: [tt]&whereSearch=`tv`[/tt]. I don’t fully understand the syntax of the [tt]&extract[/tt] parameter. From the wiki documentation it looks like [tt]&extract=`1:tv_content`[/tt] is what you need rather than [tt]&extract=`1:tv_value`[/tt]?

        I think that [tt][+as.description+][/tt] will output the contents of the document variable description field. You probably want to use [tt][[YAMS? &get=`data` &from=`description` &docid=`[]`]][/tt] instead. (I’d use [tt]&get=`data`[/tt] rather than [tt]&get=`content`[/tt], because in the next version of YAMS [tt]content[/tt] will be phased out and [tt]data[/tt] will function correctly for monolingual documents as well as multilingual documents.)

        I don’t think it will be possible to implement a fallback language for the extract since I can’t think of a way to overcome the fact that AjaxSearch supplies only one extract from one field.
          YAMS: Yet Another Multilingual Solution for MODx
          YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
          Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
        • The previous examples didn’t completely work for me, we added the whereSearch statement in the snippet call with content:NULL, with this code we prevent that Ajaxsearch is looking in the content table instead of the Template Variables

          Here is the code:

          [!AjaxSearch? &ajaxSearch=`0` &clearDefault=`1` &tplResult=`AS_Result` &asLog=`2:0:1000` &tvPhx=`tv:displayTV` &language=`(yams_mname)` &withTvs=`+:content_(yams_id) ,description_(yams_id), introtext_(yams_id), longtitle_(yams_id), menutitle_(yams_id),pagetitle_(yams_id)` &whereSearch=`content:NULL`!]

          Tested with modx 1.0.4 and Ajaxsearch 1.9.0
          • I feel like I’m so close with this. I finally upgraded to AjaxSearch 1.9.2b, so I’m not sure what information in this thread is relevant. The search more or less works. What I’m running into is that the extracts are always in English (right now there’s only English and Japanese on the site, but eventually there will be more) and it’s grabbing pages that don’t have the multilingual TVs that - I think - I’m specifying in the query.

            As a note, when I use &asId in the landing page calls, I get a blank response from AjaxSearch. This is all live btw, so you can check:


            (I’ve been using ’hunting’ as a test search query)

            Any guidance would be appreciated.

             [!AjaxSearch? &asId=`(yams_id)` &ajaxSearch=`0` &landingPage=`56` &showResults=`0` &highlightResult=`0` &tplInput=`search-form_(yams_id)` &withTvs=`+:content_(yams_id),description_(yams_id),introtext_(yams_id),longtitle_(yams_id),menutitle_(yams_id),pagetitle_(yams_id)` &language=`(yams_mname)`!]

            Landing page call:
            [!AjaxSearch? &ajaxSearch=`0` &showInputForm=`0` &showResults=`1` &tplResult=`search-result` &language=`(yams_mname)` &highlightResult=`0`!]

            search-result chunk
            <div class="[+as.resultClass+]">
            <a class="[+as.resultLinkClass+]" href="[+as.resultLink+]" title="[[YAMS? &get=`data` &from=`longtitle` &docid=`[]`]]">[[YAMS? &get=`data` &from=`longtitle` &docid=`[]`]]</a>
              <span class="[+as.descriptionClass+]">[[YAMS? &get=`data` &from=`description` &docid=`[]`]]</span>
              <div class="[+as.extractClass+]"><p>[+as.extract+]</p></div>
              <span class="[+as.breadcrumbsClass+]">[+as.breadcrumbs+]</span>

            I hope I’m doing something stupid that will be easy to fix smiley
            • 4. Change redirection type in Modules → YAMS → Other Params → URL Redirection Settings → Redirection Mode to “Current else Browser” for correct redirection to pages searched.

              This helped me with eForm redirect to the right language (&gotoid=`22`)
                Evolution user, I like the back-end speed and simplicity smiley