Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by adrian

  1. Sorry, because I don't actually use a translation service to translate content in the admin I took the easy way out and just implemented a direct curl request to the Lingvanex API.
  2. @fruid - the selector field is part of the PW core. You can limit the available fields with this setting "limitFields" => ["field_one","field_two"] Hope that helps.
  3. Did you recently update the main Hanna module? @teppo's helper hasn't been updated to support that new version yet.
  4. adrian

    Hanna Code

    Try calling the function like: \ProcessWire\myFunction()
  5. @teppo - sorry for the barrage. Again, don't worry about this if it's not important to you, but I noticed an issue with highlighting in the auto description if there is punctuation in the search, eg: https://ian.umces.edu/search/?q=bird's+head Note the last result: "Science communication training for West Papua, Indonesia" doesn't highlight "Bird’s Head" because it's not a regular single quote character used for the apostrophe. I wonder if highlight matching can / should ignore punctuation characters?
  6. @ryan - also wondering what you think about supporting multiple operator options in the ProcessPageSearch settings? I am quite liking the *=~*= combination.
  7. Hi @teppo - I've been playing around with multiple operators (https://processwire.com/docs/selectors/operators/#using-more-than-one-operator-at-a-time). I think you mentioned that these aren't supported, so please feel free to ignore this request, but what I discovered when using this operator combination: *=~= is that the grouping feature no longer works if PW fails to find any results via *= and moves on to ~= All results end up being listed under the All tab with no other tabs shown. For now I've gone back to my old approach to adding the tabs which works with this operator. I have also played around with the #= operator which I think will need some special handling to support because of the need to additional additional quotes and escaping. Just rambling out loud here - I also played around with adding basic support for swapping between *= and ~= depending on whether the user's search term includes double quotes. I almost stuck with that approach but I am honestly not sure how many non-tech users know about quoting search terms, so I thought the *=~= was probably better for most people.
  8. @ryan - just playing around with some of the new options here and they are really awesome, thank you! I was initially confused about how to use this example: +(foo bar) or +"foo bar" indicates the phrase "foo bar" MUST appear My experiments showed this. Unless I am missing something, to use the double quote option, you need to have two sets, with the inner set escaped. This is OK, but I feel like perhaps it could be better documented. The other thing I have noted is a feature request to add support for excluding stopwords when doing partial matches. For example, "University of Queensland" is great when you're searching for the phrase, but if you are using multiple operators at a time, eg: *=~=~|= you really don't want that last operator (~|=) to match the "of" if the other words don't exist. Is there a way to do this already, or is it something that you could support fairly easily? Or, would you recommend that we do this at the server level using MySQL's "ft_stopword_file" setting?
  9. How big is the DB for the site? The backup mechanism built into the upgrade process (and also via ProcessDatabaseBackups) doesn't handle large DB's very well at all. I actually recently requested that Ryan consider changing the latter to use native backup tools (ie mysqldump) to avoid this. Does the upgrade work OK if you just tell it not to backup? I don't honestly see the point in the backup while upgrading - PW upgrades almost never make changes to the DB anyway.
  10. Thanks @Zeka - I wonder why I am not seeing the issue here? I understand your changes, but not really sure why they are necessary. Oh well 🙂 Anyway, thanks very much for the fix - I have made that change (and also changed it in the Tracy logs panel) and committed a new version. Thanks again for all your efforts and have a great weekend!
  11. @teppo - I looked into the issue with truncation of entities a little more and it seems like there are a couple of different approaches to fix this. The simplest seems to be to simply remove any trailing bits of entity that is left over, eg: $value = rtrim(preg_replace('/(?:<(?!.+>)|&(?!.+;)).*$/us', '', $value)); as mentioned here: https://www.drupal.org/project/drupal/issues/2279655#comment-8843201 - there is some other useful discussion there about this issue. Another approach I've come across is to calculate the length by treating the entities as a single character like they detail here: https://gist.github.com/andykirk/b304a3c84594515677e6 and https://alanwhipple.com/2011/05/25/php-truncate-string-preserving-html-tags-words/ I tried the first approach and it seems to work fine. Hopefully this might save you a bit of time. This is where I've put it for now: protected function formatResultAutoDesc(string $match, string $index, string $desc): string { if ($match !== '') { $match_length = mb_strlen($match); $add_prefix = (empty($desc) || mb_substr($desc, -3) !== '...') && (mb_strpos($match, '...') === 0 || mb_substr($index, 0, $match_length) !== $match); $add_suffix = mb_substr($index, -$match_length) !== $match || mb_strrpos($match, '.') !== $match_length; // Remove scraps of HTML entities from the end of a strings $match = rtrim(preg_replace('/(?:<(?!.+>)|&(?!.+;)).*$/us', '', $match)); $match = ($add_prefix ? '...' . $match : $match) . ($add_suffix ? '...' : ''); } return $match; }
  12. Ah, thanks for the help finding that. The only change I have made to that panel since 4.21.7 is this: https://github.com/adrianbj/TracyDebugger/commit/98fae74bcdb5e993d20f9fda37133c7979f39698#diff-2e20cde51fd606941fbeee53c0a07be98e04a3bd86e420f9fb5d10d54a28d0b1R56 But I can't see how that would break things. I am curious if there is something unusual in your PW logs that might be breaking the JS side of things somehow?
  13. Hi @Zeka - there have been a lot of changes to both this module and also the Tracy core since 4.21.7 so I am not quite sure where to start but I think that is a JS error, correct? Is there any more info in the browser dev console about this error?
  14. Thanks @teppo This exact text in a textarea with a HTML Entity Encoder textformatter should allow you to replicate the issue. After attending a former colleague's birthday party, Bill Dennison recounts fond memories of time he spent with Tony Larkum in Australia and the United States that spanned from the 80's through early 2000's. Yes, sorry about that 🙂
  15. I just changed the $desc_max_length from 255 to 265 and that fixed it, so I think my last suggestion about it truncating in the middle of the &#039;s is correct. Here is the output of $value from ___renderResultDesc() which confirms it! <div class="{classes.result_desc}">Tony Larkum's 80th Birthday Party ... After attending a former colleague's birthday party, Bill <strong class="{classes.result_highlight}">Dennison</strong> recounts fond memories of time he spent with Tony Larkum in Australia and the United States that spanned from the 80&#0...</div>
  16. @teppo - just took a better look at this and it is related to the HTML Entity Decoder textformatter that I have applied to the excerpt field. If I dump the content of $index in the Renderer::getResultAutoDesc method, I see this: 'Tony Larkum's 80th Birthday Party ... After attending a former colleague&#039;s birthday party, Bill Dennison recounts fond memories of time he spent with Tony Larkum in Australia and the United States that spanned from the 80&#039;s through early 2000&#039;s. What is interesting to me is that the &#039; in "former colleague&#039;s birthday" looks as expected, but the one in "the 80&#039;s through" is converted to that � icon. If I add this line: $index = $this->wire('sanitizer')->unentities($index); then it works as expected, although I don't think we want to do that. I feel like this is somehow related to one of the regexes and a " 's " right at the end of the autodesc. Maybe it's truncating the &#039;s to something like &#03 which it doesn't know how to display?
  17. Sorry @teppo - just noticed a character encoding issue. I have an excerpt (plain textarea) field which is being indexed and I am seeing this in the results: https://ian.umces.edu/search/?q=dennison That � is a normal single quote character which you can see here: https://ian.umces.edu/blog/page2/ Let me know if there is any other info I can provide.
  18. Thanks @teppo for the new dev version - been playing around with that and the new auto desc and highlighting changes seem great!
  19. This is probably the "right" way to do it: https://github.com/processwire/processwire/blob/d8945198f4a6a60dab23bd0462e8a6285369dcb9/wire/config.php#L1274-L1280 Also note that most / all WireMail modules have their own settings for this as well which is where I typically set it.
  20. Maybe you know this already, but that FB config won't affect AdminActions, but it does let me know that the only wiremail module you have installed is WireMailSmtp which is helpful. I think it should be being sent using it, but these days sending via SMTP is getting more and more difficult. I pretty much exclusively use services like Mailgun now. If you want better reliability from SMTP and you are using gmail for that, you might want to try Ryan's https://github.com/ryancramerdesign/WireMailGmail because it will allow you to use proper authentication to access to it, rather than needing to enable the "less secure apps" option which might be the reason you are seeing that "could not verify" message.
  21. It should use it automatically - the action just makes a $mail->new() call. Ryan built a module (https://github.com/ryancramerdesign/WireMailRouter) that lets you choose which wiremail module to use, but if you only have one installed, it should be used. Does that help?
  22. @bernhard - I completely agree that there is no point using AOS for just this purpose. That was my intention by saying "if you are already running" in my comment above. I know it's unmaintained, but with the features I use from it, I haven't noticed any bugs - I am sure there are likely some features that are buggy. The problem is that I really struggle to use PW without it. Just an FYI - when it was first being developed, I thought it was a crazy idea - way too hard to maintain and make stable with all those features, but it works for my needs, but I completely agree it's not something that should be recommended for one simple feature like this.
  23. Or, if you are already running AdminOnSteroids, it lets you easily load js and css files in the admin.
  24. @ryan - wondering if you could perhaps start providing a changelog for pro modules. I know this request might seem a bit OT here, but I am a huge fan of @netcarver's ModuleReleaseNotes module with the way it integrates into the module update process. It shows the git commits and the contents on a CHANGELOG file if it exists. I know that because these aren't hosted on publicly accessible repos, this might be difficult, but it would be really helpful because I always like to review what has changed about a module before updating in case it looks like there might be something that needs testing and also just to know what new features I should look out for.
  25. @ryan - just an FYI that the Events module directory entry has a forum/support button, but it has no link so it's a bit confusing. Not sure if this is an indication of a bug in the module's directory in general, or is somehow specific to this module.
  • Create New...