Posted on 2009-04-23
Last Modified: 2013-12-12
I like using "WITH QUERY EXPANSION" because it does a good job at breading the results.

However I need support for "IN BOOLEAN MODE" because
          food -bank
should remove bank-related results.

When I combine IN BOOLEAN MODE and WITH QUERY EXPANSION I get an error.
select count(`name`) as numrows from `organizations` WHERE ( replace(replace(`name`, ' ', ''),'\'', '') LIKE '%food-bank%' OR replace(`keywords`, ' ', '') LIKE '%food-bank%' OR MATCH (`name`,`keywords`,`description`,`custom_keywords`,`naics_keywords`, `naics_desc`, `p_city`, `promo_text`) AGAINST ('food -bank' IN BOOLEAN MODE WITH QUERY EXPANSION) )

Open in new window

Question by:hankknight
    LVL 19

    Assisted Solution


    select count(`name`) as numrows from `organizations` WHERE ( replace(replace(`name`, ' ', ''),'\'', '') LIKE '%food-bank%' OR replace(`keywords`, ' ', '') LIKE '%food-bank%' OR MATCH (`name`,`keywords`,`description`,`custom_keywords`,`naics_keywords`, `naics_desc`, `p_city`, `promo_text`) AGAINST ('food -bank' IN BOOLEAN MODE) )

    Open in new window

    LVL 19

    Expert Comment

    What is your goal for this?
    LVL 23

    Expert Comment

    What is the error?
    LVL 16

    Author Comment

    This is no such thing as "IN BOOLEAN MODE and WITH QUERY EXPANSION"  but can I accomplish the same thing with a revised query?
    LVL 23

    Accepted Solution

    I've done searches where I include two MATCH expressions, one of which is using IN BOOLEAN MODE. This way I can combine the boolean features with the better scoring of the standard match.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to count occurrences of each item in an array.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now