ALL Products are shown in basic search results

Hi All,

I am relatively new to SuiteCRM and have installed and imported all our accounts and products. It seems to fit our needs fairly well and I only have a few minor things that I still need to get working.

Including the search of Products.

So with AOD disabled, I receive the full list (paginated) of Products in the basic search results page. With AOD enabled I do not receive any product results no matter what I search for.

I have enabled Products in the Admin -> Global Search settings as well as enabled the Products module in the search results page.

I have a few custom fields added to the Products module, but I am only searching for the product name (field name ‘name’).

Is there anything else I need to enable or be aware of to produce correct Product Name results?

Thanks!

You should leave AOD Search on, and get it working.

You probably didn’t configure your Scheduler Jobs. See Admin / Scheduler, there are instructions at the bottom of the screen, specific to your installation.

A couple of jobs there are needed to keep AOD functional, namely

Perform Lucene Index
Optimise AOD Index

You can check their “last ran successfully” time, it probably says “never”.

Hi pgr,

I have configured the cronjob and it both the Perform Lucene Index and Optimise AOD Index were run today. The Lucene Index runs at 0:00 daily, so about 11 hours ago and the Optimise AOD every 3 hours, so about 2 hours ago was the last time that ran.

I have imported the products way before that.

I am not sure whether the Import process indexes anything. So maybe you need to trigger a full reindex.

https://pgorod.github.io/Reindex-AOD/

Also note that only some of the fields get indexed, so you need to search by an indexed field (try it with last name in Contacts, for example). This is configurable in Studio.

Thanks for the link to your SuiteCRM in-depth blog. There was some super helpful stuff in there!

Unfortunately the reindexing did not allow me to search for the ‘name’ field of my Products.

Both ‘Optimise AOD’ and ‘Perform Lucene Indexing’ have run again since I moved / made a backup of the Index folder and deleted all contents of the two tables, ‘aod_index’ and ‘aod_indexevents’ - and I still do not receive any Products as search results via AOD Search. The basic search still returns all products as well.

Is there anything else I may be missing here? I am not trying to search on any of the custom fields I have added, just the ‘name’ in Products field.

EDIT: I want to add that previously, I was not able to even search via the “Filter” mechanism in the Products page itself. This now works at least!

Can you search other modules correctly?

The indexed search only indexes some fields in some modules, not all. This is configurable in Studio.

So I would start by checking if search is operational by trying searches for Last names of Contacts, for example.

I am able to search, for example, for contact Last Names, as well as Product Categories.

Where in Studio is this configurable? Here is my studio config page for the ‘Name’ field in Products:

I could swear it was configurable via Studio… but it isn’t. I was mistaken, sorry.

I tried to find how to configure it elsewhere, and I asked some people who might know, but I ended up with nothing.

i admit this is a basic feature to have, searching for products. Maybe you want to open an issue on Github asking for it; or, if you have the resources, get a developer to work on it and contribute the improvement on Github. Thanks.

Hi pgr,

Unfortunately we dont have the resrouces, but okay well not a huge deal - I thoguht I was just missing somethign / doing something wrong.

Like I said, you can search for Products when you go into the Products page now and go through the ‘filter’ option.

Thanks for your efforts!

Ok, with help from a friend I have something for you to try:

This should be as easy as enabling the unified search for the module. The AOD already indexes most of the fields for the modules that are enabled.

There are some modules that are on the AOD black list like:

“AOD_IndexEvent”,“AOD_Index”,“AOW_Actions”,“AOW_Conditions”,“AOW_Processed”,“SchedulersJobs”

For the Products module you should create a file like custom/Extension/modules/AOS_Products/Ext/Vardefs/UnifiedSearch.php

Enable the unified search, something like :


<?php
$dictionary['AOS_Products']['unified_search'] = true;
$dictionary['AOS_Products']['full_text_search'] = true;
$dictionary['AOS_Products']['unified_search_default_enabled'] = true;
?>

I think this is all you need, let me know if you have problems.

Hi pgr,

Thanks for the effort here!

I have created a UnifiedSearch.php file with the following contents:

<?php
$dictionary['AOS_Products']['unified_search'] = true;
$dictionary['AOS_Products']['full_text_search'] = true;
$dictionary['AOS_Products']['unified_search_default_enabled'] = true;
?>

I also have had the two schedulers, Optimise AOD and Perform Lucene Indexing, run through.

Unfortunately I was still not able to search for Product Names.

In the dir: custom/Extension/modules/AOS_Products/Ext/Vardefs/ there was already a file named: sugarfield_name.php with the following contents:

<?php
 // created: 2018-07-06 15:15:11
$dictionary['AOS_Products']['fields']['name']['required']=true;
$dictionary['AOS_Products']['fields']['name']['inline_edit']=true;
$dictionary['AOS_Products']['fields']['name']['duplicate_merge']='disabled';
$dictionary['AOS_Products']['fields']['name']['duplicate_merge_dom_value']='0';
$dictionary['AOS_Products']['fields']['name']['merge_filter']='disabled';
$dictionary['AOS_Products']['fields']['name']['unified_search']=true;
$dictionary['AOS_Products']['fields']['name']['audited']=true;

 ?>

The unified_search dictionary field was initially set to false, I have also just updated it to true.

LG
Nico

Please try creating a new product now, and see if you can search by that product’s name, just as a test.

Unfortunately I was not able to find the newly created Product in the search results. Using basic search also did not return anything new / different.

Is this possibly just not supported yet? Like you have mentioned previously, it does seem like a rather basic feature, but maybe it is just not implemented yet?

I’m not sure what is going on.

I had a look at the code that indexes records, and it’s pretty generic. It should be able to index mostly any module and any field you throw at it.

So there is no reason for it to fail with Products module, once it is enabled…

I’ll give it a couple of days to see if I can come up with some idea…

Did you remember to do a Quick Repair and Rebuild after changing the files?

I had not. But I did just now, and unfortunately it did not help :frowning:

I just tried it and it works for me.

It should be working for you, as long as the Product is already indexed. I tried it with a new product (gets indexed immediately, it doesn’t have to wait for the Scheduler job to run).

If it doesn’t work, try removing that file custom/Extension/modules/AOS_Products/Ext/Vardefs/sugarfield_name.php

Do a QR&R again

Create a new product with a distinctive name, and search for it

Thanks for double checking, so we know it SHOULD work. There is just soemthign wrong with my setup then.

I renamed it sugarfield_name.php.bak (in case I need to restore it) and did a QR&R and searched again - unfortunately no product results.

I then added a new product and searched again for that - also unfortunately not found in the search results.

Do you see any serious (FATALs etc) errors in your logs?

Especially at the time of the search, but also at the time of record creation…

So before I went to close out of the tab I decided to give the search one more try.

Low and behold it worked! I assume one of our last changes did the trick and then some scheduled task just had to run through still.

Anyway thanks again a ton for your help!