Keywords as a search criteria

Propose here your templates, your plugins or ask one.
All tutorials available for Arfooo Directory are available in this category.

Moderator: effi

Keywords as a search criteria

Postby ping » Sat May 02, 2009 12:47 am

Hello
How can I add the keywords in the search?
I mean like the search understand the arfoo_keywordsofsites as a normal field (ie: description), and use with the rest of the criterias

the line is from models/SiteModel.php, but I need some help to modify the rest (there's no siteKeywords field since its from another table and I also think that a IF is needed)

$c->add("MATCH (siteTitle, description)

if thats not possible, there's another solution like a "keyword search" or "keyword filter"?

thank you
ping
 
Posts: 23
Joined: Sat May 02, 2009 12:41 am

Re: Keywords as a search criteria

Postby chadon » Sat May 02, 2009 12:26 pm

I am sorry not to be able to help for this but from what I saw, you are not the only one to complain about the performance of the search engine so hopefully, this will be improved in a future version.

Edit: Arf explained how to add an extra field to the search engine in the French board. Maybe this will do what you want.
You can take a look at the code here:
http://forum.arfooo.com/post5232.html
and if you need the instructions to be translated, let me know.
chadon
 
Posts: 59
Joined: Mon Jan 19, 2009 10:29 pm
Location: NB Canada

Re: Keywords as a search criteria

Postby ping » Sat May 02, 2009 2:58 pm

sure i already did that, but it really sucks that this feature is not available
but ok, i'm going to try to make a keyword filter by myself
ping
 
Posts: 23
Joined: Sat May 02, 2009 12:41 am

Re: Keywords as a search criteria

Postby ping » Sat May 02, 2009 10:56 pm

I can make the script if somebody help me to translate this to a mysql query:
you only need to look at the bold part, because i can do the rest

- user enter the $search or whatever you want to name the $
- if $search = arfooo_keywords.keyword, get the keywordID from the same line
- switch to table arfooo_keywordofsites.keywordID and list all the siteID that uses that keywordID
- list all the matches
and transform siteID on the site name

ps: i think it will use something like (from the arfooo_keywords.keyword)

WHERE keyword LIKE '%$search%'
ping
 
Posts: 23
Joined: Sat May 02, 2009 12:41 am

Re: Keywords as a search criteria

Postby chadon » Sun May 03, 2009 11:16 am

I can probably get some help in the French forum but before I do so I have a question. Would this code search for links depending of their title/description content AND keywords or would you have two options to search for the links content OR keywords?
If it's the second, I can probably write something much more easy to implement.
chadon
 
Posts: 59
Joined: Mon Jan 19, 2009 10:29 pm
Location: NB Canada

Re: Keywords as a search criteria

Postby chadon » Sun May 03, 2009 11:58 am

Never mind my last question, my idea won't work.
I will ask for help in the other forum. :mrgreen:
chadon
 
Posts: 59
Joined: Mon Jan 19, 2009 10:29 pm
Location: NB Canada

Re: Keywords as a search criteria

Postby ping » Sun May 03, 2009 1:38 pm

i think its not "that" complicated
all we need is a person that know how to make a proper query, with INNER JOIN, LEFT or whatever is needed
too bad I cant, i event tryed but no sucess
ping
 
Posts: 23
Joined: Sat May 02, 2009 12:41 am

Re: Keywords as a search criteria

Postby chadon » Sun May 03, 2009 3:10 pm

Arf just gave instructions for what you want. He didn't test it but he says it should work.
http://forum.arfooo.com/post7191.html

Open the file: "models/SiteModel.php"

Line 303 after the " { " add:
Code: Select all
            $prefix = Config::get("DB_PREFIX");
            $c->addOr("EXISTS(SELECT * FROM ".$prefix."keywords
                       INNER JOIN ".$prefix."keywordsofsites ON ".$prefix."keywordsofsites.keywordId=".$prefix."keywords.keywordId
                       WHERE LOCATE( '$rawPhrase', keyword ) > 0
                       AND ".$prefix."keywordsofsites.siteId = ".$prefix."sites.siteId)");
chadon
 
Posts: 59
Joined: Mon Jan 19, 2009 10:29 pm
Location: NB Canada

Re: Keywords as a search criteria

Postby ping » Sun May 03, 2009 9:40 pm

thank you guys!
here is the final code (the line you told I think it's the wrong function)

just replace the original for this:

Code: Select all
    function createSearchCriteria($phrase)
    {
        $rawPhrase = addslashes($phrase);
        $phrase = strtr($phrase, '+-><()~*"', ' ');
        $words = preg_split("#\s+#", $phrase);
        $phrase = "+".implode(" +", $words);
       
        $phrase = addslashes($phrase);
        $c = new Criteria();
      $prefix = Config::get("DB_PREFIX");
      

        $c->add("MATCH (siteTitle, description)
        AGAINST ('$phrase' IN BOOLEAN MODE)");
      
      $c->addOr("EXISTS(SELECT * FROM ".$prefix."keywords INNER JOIN ".$prefix."keywordsofsites ON ".$prefix."keywordsofsites.keywordId=".$prefix.   "keywords.keywordId WHERE LOCATE( '$rawPhrase', keyword ) > 0 AND ".$prefix."keywordsofsites.siteId = ".$prefix."sites.siteId)");
        $c->addOr("LOCATE( '$rawPhrase', url ) > 0 ");
        return $c;
    }

bye
ping
 
Posts: 23
Joined: Sat May 02, 2009 12:41 am

Re: Keywords as a search criteria

Postby chadon » Sun May 03, 2009 10:01 pm

Glad we could help and thanks for your correction sent in the two forums ;)
chadon
 
Posts: 59
Joined: Mon Jan 19, 2009 10:29 pm
Location: NB Canada

Re: Keywords as a search criteria

Postby skdo84 » Fri Jun 12, 2009 4:46 am

ping wrote:thank you guys!
here is the final code (the line you told I think it's the wrong function)

just replace the original for this:

Code: Select all
    function createSearchCriteria($phrase)
    {
        $rawPhrase = addslashes($phrase);
        $phrase = strtr($phrase, '+-><()~*"', ' ');
        $words = preg_split("#\s+#", $phrase);
        $phrase = "+".implode(" +", $words);
       
        $phrase = addslashes($phrase);
        $c = new Criteria();
      $prefix = Config::get("DB_PREFIX");
      

        $c->add("MATCH (siteTitle, description)
        AGAINST ('$phrase' IN BOOLEAN MODE)");
      
      $c->addOr("EXISTS(SELECT * FROM ".$prefix."keywords INNER JOIN ".$prefix."keywordsofsites ON ".$prefix."keywordsofsites.keywordId=".$prefix.   "keywords.keywordId WHERE LOCATE( '$rawPhrase', keyword ) > 0 AND ".$prefix."keywordsofsites.siteId = ".$prefix."sites.siteId)");
        $c->addOr("LOCATE( '$rawPhrase', url ) > 0 ");
        return $c;
    }

bye

thanks, that worked for me :)
skdo84
 
Posts: 4
Joined: Tue Jun 02, 2009 5:37 am
Location: Germany

Re: Keywords as a search criteria

Postby seopositive » Sat Jul 04, 2009 8:07 am

A type of search that looks for matching documents that contain one or more words specified by the user.
seopositive
 
Posts: 5
Joined: Mon Jun 29, 2009 7:36 am

Re: Keywords as a search criteria

Postby hosting456 » Sat Sep 12, 2009 9:22 am

Hi,

You will find that it is very difficult to achieve higher search engine ranking, without geniue quality content.

Nevertheless, you may find the following information useful, about meta tags, which can be used to provide search engines with additional keywords: http://www.brugbart.com/?AID=81

The best way to get higher search engine ranking, is to make sure high-quality relevant pages link back to you. Also make sure that your keywords actualley apear somewhere in your content, and you don't duplicate content.

You may also wan't to create a sitemap, see http://www.sitemap.org/ for more information. This step won't make sure your pages apear, but it dose make sure search engines know about all your pages.
hosting456
 
Posts: 8
Joined: Sat Sep 12, 2009 12:54 am

Re: Keywords as a search criteria

Postby erslageorge » Mon Nov 29, 2010 4:53 pm

Keywords are terms and phrases, including a combination of letters, numbers, and special characters on which you can base your search. When creating document search criteria, you can use a combination of keywords, operators, wildcard characters, and grouping to define your query. Try to be as spWhen creating document search criteria, you can use a combination of keywords, operators, wildcard characters, and grouping to define your query. Try to be as specific as possible when coming up with search criteria.

______________
Search Craigslist
erslageorge
 
Posts: 5
Joined: Mon Nov 29, 2010 4:25 pm

Re: Keywords as a search criteria

Postby disolmodo78 » Mon Nov 29, 2010 6:09 pm

I think it is &quot;that&quot; complicates everything we need is someone who knows how to do proper consultation with INNER JOIN, LEFT or whatever it takes a shame I can not, I tried to events, but without success.
disolmodo78
 
Posts: 9
Joined: Mon Nov 29, 2010 6:05 pm

Next

Return to Templates, plugins and tutorials

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

 
Copyright © arfooo.net  2007 - 2010  -  All rights reserved.
Arfooo website group: petites annonces gratuites   voyance en direct - tirage tarot   Consultant en référencement
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group | phpBB SEO
cron