ordering Full Text Search results on emails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SIG
    Junior Member
    • Mar 2020
    • 6

    ordering Full Text Search results on emails

    Hello,

    We are using EspoCRM v5.7.11 + MariaDB 10.0 for about 6 months. We are using espoCRM about 4 years ago and everything works fine.

    Now we are looking to Full Text Search option for emails, it works: requests on email give results using the option to force FTS: ft:+word1+word2... If we "don't force with ft:", it sometimes don't use the FTS index.
    However, this is not very "user friendly" (users always search word1 word2 and don't know about + or - or whatever) and we think results could be better. Is everybody satisfied with the results?
    We are looking for a solution to sort emails by relevance score (+date sent) but the only option alowed is sort by date. No field relevance (moreover hte order by should be MATCH(columns) AGAINST ('what is searched' IN NATURAL LANGUAGE MODE)).

    The best case would be ordering by relevance score (if two words are found, they will be presented first and if only one, it will be at the end).
    Is it posible? Anybody tried to do that?

    Another solution could be to add "ft:" and "+" for each word modifying js or something like that.
    The last thing we want to do is to modify the PHP SQL request.

    Any suggestions?

    Thanks
  • yuri
    Member
    • Mar 2014
    • 8442

    #2
    Hi,

    You can force sorting by relevance. See:

    https://github.com/espocrm/espocrm/b.../Email.php#L36

    https://github.com/espocrm/espocrm/b...s/Base.php#L77


    I think full-text is not used when the query string is too short, or contains some characters that would broke the full-text search.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • SIG
      Junior Member
      • Mar 2020
      • 6

      #3
      Hello yurikuzn,
      Before your tip, i was looking in /application/Espo/ORM/DB/Query/Base.php
      Thanks for the answer. That's exactly what i was looking for!!
      And when i have a look to the generated query, it is the goor order by with MATCH(columns....
      We will see during the week if users like it more.
      Thanks again.

      Comment

      • SIG
        Junior Member
        • Mar 2020
        • 6

        #4
        Should i close the topic? don't see any button?

        Comment

        • yuri
          Member
          • Mar 2014
          • 8442

          #5
          No need to close.

          Just for information: If you customize Email select manager class, it's better to create a custom class: https://github.com/espocrm/documenta...select-manager
          If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

          Comment

          • esforim
            Active Community Member
            • Jan 2020
            • 2204

            #6
            Didn't know you can close topic. Always leave the thread open for future user.

            Didn't even know about these "ft" and "+" commands. There really need a tool tips button so these feature/function don't get lock up away without the majority user knowing about it.

            Comment

            • SIG
              Junior Member
              • Mar 2020
              • 6

              #7
              Originally posted by yurikuzn
              No need to close.

              Just for information: If you customize Email select manager class, it's better to create a custom class: https://github.com/espocrm/documenta...select-manager
              After a weeks of use, everything works fine and the results are good. Yes, we had it in a custom class however at the begining we were not sure it would work.

              "Didn't even know about these "ft" and "+" commands. There really need a tool tips button so these feature/function don't get lock up away without the majority user knowing about it."
              We did not put any tip because the relevance results are relevant. :-D
              Thanks

              Comment

              • esforim
                Active Community Member
                • Jan 2020
                • 2204

                #8
                Yes, a popup button or tooltip is the best way to educate on hidden feature.

                Without hanging around forum or reading code and documentation many hidden powerful function of EspoCRM get locked away without ever being use.

                But this is a request for the Feature Request section.

                Comment

                Working...