CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Search for "AAA BBB" returns all the AAA and all the BBB!
Pages: [1]

Author Topic: Search for "AAA BBB" returns all the AAA and all the BBB!  (Read 3141 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Search for "AAA BBB" returns all the AAA and all the BBB!
October 29, 2008, 02:32:08 am
Hi,

(clarification, hopefully)

My problem is that when I search on two works, it returns all the names containing the first word, and the ones containing the second one. Moreover, the one(s) containing both aren't at the top. As we have a lot of organisations that contains "generic" words (eg european, health, youth, institute, association...), it becomes nearly impossible to find anything.

Last, but not the least, you can't create a relation anymore between an employee and her employer, as the list contains too many items, and it can't displays it back. I've tried changing the settings in the search:
/civicrm/admin/setting/misc?reset=1

But I haven't been able to improve, in one way of another.
eg on:
http://drupal.demo.civicrm.org/civicrm/contact/search/basic?_qf_Basic_display=true&qfKey=e5361be4bc57d4f185d178b250528834Searched
searched John johnson.

expects all the John johnson (ie. one), but gets all the john and all the johnson

The there a way to force an AND instead of an OR between the words ?

X+



Is there a way of requesting a strict search (google syntax "john doe") instead of john OR doe ?

That's a hell annoying when you're looking for some specific organisation (eg "european health"), as half of the organisations here are european something bla bla.



X+
« Last Edit: November 03, 2008, 02:58:36 pm by xavier »
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Search for "AAA BBB" returns all the AAA and all the BBB!
November 03, 2008, 03:04:40 pm
I've tried to clarify the problem. I'm pretty sure it did work differently on the 2.0.x, but it might be only that it searched at the start of the name instead than at any place (eg. 2.0: like query% instead of 2.1 like %query%)

Anyway, in some cases, it just makes the search not very efficient, but on others (eg adding a relationship, it brakes the functionality as soon as you have enough contacts that contains a word that is contained in the name you're trying to associate with).

Any idea ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Search for "AAA BBB" returns all the AAA and all the BBB!
November 03, 2008, 04:28:27 pm

1. we added a few more configuration options. You can tweak the behavior here: http://drupal.demo.civicrm.org/civicrm/admin/setting/misc?reset=1

2. We also added a feature to make any string in " (double quote) to be an exact search

3. the previous behavior of all strings with a space being split and wild card being prepended (and appended) is the behavior u r seeing

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Search for "AAA BBB" returns all the AAA and all the BBB!
November 04, 2008, 03:43:03 am
Hi,

The quote is to search exactly the right name (eg if I search "AA BB" it won't show "AA BB CC", right ?)

I'm not clear about how to reach what I want, please bear with me while I'm trying.

My goal is that if I search
"Foundation Youth Europe"

I find the "foundation of youth in Europe"
and the "youth foundation for a swingy Europe"

but not a list of all the foundations , starting with the "Asbestos Foundation" and ending with the "Zebra Foundation" melted with all the europe things and all the youth bla bla

I suppose it translates by splitting, but having AND instead of OR. Is there an option I didn't find ?

I've tried you settings, but didn't made it better for my need

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Search for "AAA BBB" returns all the AAA and all the BBB!
November 04, 2008, 06:44:06 am

I dont think we handle the below currently. The fastest solution is a custom search

alternatively, u can hack the code at: CRM/Contact/BAO/Query.php, line 2170 or so and modify the query there

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Search for "AAA BBB" returns all the AAA and all the BBB!
November 04, 2008, 04:02:55 pm
thanks for the lead.

I'll first try to hack it to see if things improve, and hopefully produce a patch.

More info soon

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Search for "AAA BBB" returns all the AAA and all the BBB!
November 05, 2008, 09:34:04 am
Hi,

I didn't find an sql only way.

the full text feature of mysql doesn't work on innodb. Has someone tried the Sphinx Search plugin  ?

In the meantime, I simply changed the code not to split on the " ". not perfect, but works better (well, now I can associate a company and an individual ;).

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Search for "AAA BBB" returns all the AAA and all the BBB!
November 05, 2008, 09:50:35 am

have not tried sphinx, but have experimented with solr (http://lucene.apache.org/solr/) in the past. some of my experimental code is here:

http://svn.civicrm.org/civicrm/trunk/tools/solr/

I think  using hooks to publish the xml to the solr engine should not be too hard and will be super cool :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Search for "AAA BBB" returns all the AAA and all the BBB!
November 10, 2008, 04:10:10 am
Not very clear, but seems you can plug it straight on the db.
http://wiki.apache.org/solr/DataImportHandler

To be continued...
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Search for "AAA BBB" returns all the AAA and all the BBB!
November 10, 2008, 08:30:25 am

cool. that seems relatively new, but very cool. The delta-change query will be the crux, we dont keep a detailed record of last modified time for many of the objects, so writing a sql query for that aspect might be a bit hard

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Search for "AAA BBB" returns all the AAA and all the BBB!

This forum was archived on 2017-11-26.