cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Set Minimum character for Global Search

taruchamy
11-Garnet

Set Minimum character for Global Search

We have been facing very high impact on performance due to search producing results more than 20000 objects.

I would like to know is there a way to set the minimum number of characters to be used for the global search.

The present scenario is searching with a*, t* etc., - I need atleast 3-4 characters to be used for the search.

Checking with PTC -

The preference below is to have minimum characters for the participant search.

com.ptc.netmarkets.participantPicker.requiredCharacterSearch

Default: -1
Synopsis: This property controls whether the participant picker requires a specific number of characters before executing.
Description: If the property is set to -1 (by default), then the participant picker will execute a search regardless of the number of characters in any of the fields. Depending on the number of participants in the system, an unbound search could cause a major performance delay. Changing this value to an integer will specify the number of characters required in at least one field before executing the search.

6 REPLIES 6
mrane
12-Amethyst
(To:taruchamy)

The mentioned property will work only for a participant picker. Participant picker is used for searching users only. I believe, in your case you are using the top right hand global search, which can search across various objects.

There are various things that come to my mind as a solution/ workaround for your issue:

1. Are you doing an 'All Type' search with a*,t* as the criteria ? Is it possible for you to narrow down your search for specific objects ? For ex: Part and Document etc.

2. There are properties that let you have a predefinined number of rows to be returned. If the result set exceeds the number that is specified, a banner message is shown indicating that the search result more results that the limit.Following are the properties to be set in db.proeprties:

wt.pom.paging.snapshotQueryLimit

wt.pom.queryLimit

By default, these are set to -1 which indicates there is no limit to the result set returned. There are a few well written articles at PTC tech support to explain these proeprties in details.

3. From what I understand, you would like to restirict search if the number of characters entered are less tahn 3 or 4. Customization will be required to achieve this.

The Global Search is rendered using Twin Trigger field which is an EXTJS component. The rendering code can be found at -

<WT_HOME>\codebase\netmarkets\javascript\util\jsfrags\globalSearch.jsfrag

The line would look something like - twinField = new Ext.form.TwinTriggerField({ ....

There is a js function is globalSearch.jsfrag viz. loadSearch(...). This too might require a change.

Note: This customization will not work on the search page that is available through the navigator.

-Malavika

taruchamy
11-Garnet
(To:mrane)

Hi Malavika,

Thanks for the reply.

I need to use it for both "top right hand global search" and the Navigator search.

And yes, we are resticting the search towards ONE specific object type - Not even two.

I have already set to 10000 for pom query limit - Reducing this will have issue in displaying the where used objects - Especially for our standard objects [Display will be blank on where used report].

Though it will not work on navigation search, I can try customizing it with your suggestion - Can you able to provide clear steps ?

Thanks

Murthi

mrane
12-Amethyst
(To:taruchamy)

In that case I would recommend you go through the file I mentioned above and dig through the code there. globalSearch.jsfrag should be used to customize the global search.

Whereas, to cutomize the search page would be a little more effort. One has to have the following considerations :

1. Should the search be restiricted based on number of characters only for the keyword filed ? or would you need similar restiriction on all the attributes ?

2. Would you want a similar restiriction in case of newly introduced IBA's ?

The rendering for the navigator search page happens from <WT_HOME>\codebase\netmarkets\jsp\searchcommonSearch.jsp.

-Malavika

taruchamy
11-Garnet
(To:mrane)

Hi Malavika,

Thanks again.

I will go through the code globalSearch.jsfrag and searchcommonSearch.jsp.

To start with I am looking out option to restricting only the keyword character.

Thanks

Murthi

LoriSood
22-Sapphire III
(To:taruchamy)

Were you able to get what you needed based on Malavika's responses? If so, can you please mark the thread as answered?

Hi Murthy,

Malavika was trying to emphasize on below changes:

Add below JavaScript after line  #189 "var searchString = encodeURIComponent(obj.getValue());"

var n = searchString.lenght;

if(n <= 3)

{

     JCAAlert("More than 3 characters are required to search!!!");

     return;

}

Refer below image from my test machine.

search.png

Thanks Malavika for sharing your thoughts and clue.

Regards,

Shirish

Announcements


Top Tags