2

Is there a search index that needs to be updated so CiviCRM Advanced search can find custom field data that was added directly to the database?

I created a custom field for Individuals (which is set to searchable).

If I enter the data from within an Individuals account, and then use the Advanced search, it finds the data no problem in that custom field.

However, I wrote a php script to import a large amount of data and add it to this custom field directly in the database (did not use CiviCRM API at all). When I go into an Individual account, I can see that the custom field is populated properly. But when I go to Advanced search and try to find any of the data using that custom field, it says "No Matches found".

What needs to happen for this data to be indexed and searchable?

EDIT: I am using wordpress (just updated to v5.9), and am wondering if it could be a cache related issue, although I not using any caching plugins.

EDIT: Issue was that data imported direct into database included a newline character on the end of each one... had to remove the newline character and then Advanced search started working as expected.

5
  • There isn't any indexing done, if they appear on contact record from GUI thn the search should be able to search. What field are you trying to do a search? Select/Multi-select/cehckbox/text? Jan 26, 2022 at 1:58
  • @PradeepNayak It is a text field (alphanumeric).
    – jsherk
    Jan 26, 2022 at 2:01
  • Are you searching by exact name? Jan 26, 2022 at 2:10
  • If you've found the solution, and it looks like you have, then you should post that as an answer.
    – Graham
    Feb 2, 2022 at 9:37
  • @Graham I selected pradeeps answer as correct already, and also posted the solution within the question already as well.
    – jsherk
    Feb 2, 2022 at 13:41

1 Answer 1

3

The search on text field should be exact match. Are you searching by exact name? Hope so there isn't any space at the start or end of the string!

1
  • 1
    So although my data appeared correct when viewing from CiviCRM, when I went back into the database to check it, I realized there was newline character at the end of every piece of data I inserted. Wrote a php script to remove that, and now working great... so the issue was PEBKAC :( but now it is solved!
    – jsherk
    Jan 26, 2022 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.