Custom Integer Field to Lucene Index

Iā€™m working on a project where Iā€™ve created auto increment project numbers for projects. This works great!

However, I canā€™t seem to get the field to be searchable in the general search.

Iā€™ve seen a few posts about this here but itā€™s kind of confusing some say ā€œnot to worry custom fields automatically get added to search indexā€, other say you have to add to the vardef to enable it to be searchable like this: ā€˜force_unifiedsearchā€™=>true, nothing seems to be working.

Iā€™m wondering if itā€™s because itā€™s an integer field thats the problem.

Anyone ever done this? Have som tips?

I notice when I search for quote numbers (another auto increment field) it doesnā€™t work either?

I donā€™t know the answer, I am just speculating here, but could it be due to the moment (in the save process) when the index is updated?

Maybe the indexing happens before the hook that sets the auto-increment number?

It is also possible (likely, even) that there are some conditions to set some fields but not others, according to types, because some types it would not be profitable to search by them, maybe these need to be tweaked.

I noticed that case numbers, quote numbers, etc. Donā€™t get indexed (which would be nice). So what I ended up doing was just storing the project ID in another field project_id_txt and then the text field gets indexed and the records get found. Kind of a work around, but it works.

1 Like