Can i change query for search

Hi, I’m new to suitecrm. I have a question can I change MySQL query for search.if yes? then where ill find query i.e, written in which file. I’m sharing the screenshot.

Hi, welcome to the Community! :tada:

It’s not that simple… but it’s possible, yes.

Please tell me a bit more about…

  1. Which version of SuiteCRM is this?
  2. Which kind of search are you using? Check Admin / Search settings. It can be either “normal”, “advanced” or “elastic”
  3. What specific changes would you like to make? What are you trying to achieve?

Hi pgr, I’m using Version 7.11.10 Sugar Version 6.5.25 (Build 344).And I want to search results through the column name. I’m sharing the screenshot with you.

  1. I have data in the OPPORTUNITIES module.
  2. I’m searching record via Sales Stage.
    3)I have a record for Appointment Schedule but I found No results.

    I hope now you understand what I want to do. sorry, I’m not able to send more than 1 image.

Can you handle some simple PHP changes? Search these forums for unified_search, that’s a flag you need to turn on to make Search work for a new field.

For example

EDIT: note that (I think) this can be enabled for a module, or for a single field. You’ll have to check if it’s enabled for Opportunities module, which I expect it is, and whether only that particular field needs enabling. I am unsure about the details on how to use this.

Thank you so much for the solution. But there is a problem when I’m searching for the query i.e. (Appointment Schedule) then I get No Results but then I remove space between query i.e. (AppointmentSchedule) then it worked for me.
if possible then I also want to get results for any of the words means if I search for Appointment or Schedule then I want results for this.
Thank You

Try adding a % sign to your query when searching for partial results.

So, to find omee instead of searching for a partial om, try om%

1 Like

Thank you pgr, Can you please tell me where is this search query is written means can you specified the exact location of file path.

It’s way more complicated than that, there is no single place that stores a query.

I would prefer you gave me more feedback on the things I have written before. I don’t know if you tried changing the vardefs, if that worked or not. I don’t know if the % helped or not.

If you apply this patch I made a few months ago, you’ll get a way to add an extra clause to the searchDefs of each module. It might help you. Any way it can serve as an introduction to the files used during query formation:

Hi @pgr,
I am in version 8.2.3. I would like to edit the default search behavior so that it becomes partial. In other words, the search string should be concatenated with the symbol ‘%’.
For example, if I search for ‘toto’, I want it to search for ‘%toto%’.

Is this possible?

Following this conversation I tried this but it does not work

public/legacy/modules/Accounts/metadata/searchdefs.php

<?php
$searchdefs ['Accounts'] = 
array (
    'whereClause' => "OR (accounts.name LIKE '%{1}%')",
    ...

Thanks

Hey @Quentin
there is a simple way to do that. Go to your config.php and look for the parameter
‘search_wildcard_infront’ and make it true
image

2 Likes

Many thanks. I was searching this . I never touught adding symbols in the search and the search was not working properly. You save my day.

1 Like