Page 1 of 3 123 LastLast
Results 1 to 15 of 43

Thread: Search relevance

  1. #1
    Join Date
    Jan 2008
    Posts
    141

    Default Search relevance

    Hello,

    I'm running a DVD Cover database and I have a little issue with the search. Let's say user search for the movie "I am legend", then they receive following 5 results:
    1. I am legend - Date Added: Jan 10, 2008
    2. I am legend - Date Added: Jan 10, 2008
    3. I am legend - Date Added: Jan 10, 2008
    4. Disney's American Legends - Date Added: Mar 1, 2008
    5. I am legend- Date Added: Apr 9, 2008

    As you can see, a movie completely different shows up as result number 4. I figured out this have to be because it's added before the fifth cover. Is it possible to change the search so that it search for the most relevant keywords first? In this case "I am legend" should first display any results with the exact sentence "I am legend" while other and less relevant results could be displayed under.

    Example, search "I am legend" returns:

    1. I am legend - Date Added: Jan 10, 2008
    2. I am legend - Date Added: Jan 10, 2008
    3. I am legend - Date Added: Jan 10, 2008
    4. I am legend- Date Added: Apr 9, 2008
    5. Disney's American Legends - Date Added: Mar 1, 2008

    Is this possible? If not, would it be possible to make search using "" to find and exact sentence? Such as searching: "I am legend" instead of I am legend.

  2. #2
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    Because "i" and "am" are not being searched, and "legend" matches "legends".

    This has been discussed on the forum previously, the minimum search word length is 3 characters. Anything under 3 is ignored completely.

  3. #3
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Quote Originally Posted by Bruceper View Post
    Because "i" and "am" are not being searched, and "legend" matches "legends".

    This has been discussed on the forum previously, the minimum search word length is 3 characters. Anything under 3 is ignored completely.
    Actually, INDEXU will search for any keyword entered regardless of length as long as you enter at least 3 characters in the search field.

    For example, if you enter I am, INDEXU will search for the words I and am.

    If you clear the search box and then click the search button, the message you receive ("Please enter the keyword at least 3 characters") is misleading.


    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  4. #4
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    line 280 of search.php

    $query .= " order by title desc";


    If these dont work youll need to make a function that gives each listing a relevancy score, please note the solution above jsut orders by title so your going to get all the same titles grouped together, it wont work out relevancy but i doubt you need that. By the way, you may need to change "desc" to "asc" i always get those 2 mixed up - it will jsut reverse the display order if its wrong.
    Last edited by inspireme; 04-09-2008 at 12:29 PM.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  5. #5
    Join Date
    Jan 2008
    Posts
    141

    Default

    Hello,

    thanks for your responses... The query code works fine I have them grouped together now... But still the problem with a complete non relevant cover showing up, either at the top or bottom in this case, but this would be random depending on first characters.

    If these dont work youll need to make a function that gives each listing a relevancy score
    I guess it's not very easy to make such function? Or is it?

    EDIT: Also I just discovered that when using the power search (searching title) it works perfect :O
    Last edited by Warz; 04-10-2008 at 11:07 AM.

  6. #6
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    Quote Originally Posted by Warz View Post
    Hello,

    EDIT: Also I just discovered that when using the power search (searching title) it works perfect :O
    It does? use powersearch instead then

    all you need to do is change the form target from search.php to power_search.php then change input field name from keyword (or whatever it is) to title.

    It will only search title then though, but it sounds like this is exactly what you want in your situation
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  7. #7
    Join Date
    Jan 2008
    Posts
    141

    Default

    Yes, it would be perfect! But when I'm trying this it doesn't search but redirect to the power search page This is what I edited:

    <form method="get" action="power_search.php" style="margin:0px">
    <%if $category_path_search_opt%>
    <input type="hidden" name="cat" value="<%$cat%>" />
    <%/if%>
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <input type="text" name="title" size="20"

    <%if $keyword%>
    value="<%$keyword%>"
    <%else%>
    value='search...'
    onblur="if(this.value=='') this.value='search...';"
    onfocus="if(this.value=='search...') this.value='';"
    <%/if%>
    />
    changed search.php to power_search.php and keyword to title

  8. #8
    Join Date
    Jan 2008
    Posts
    141

    Default

    Well I just gambled and deleted the whole search bar and restored it with this:

    <td>
    <table width="770" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td style="background-image: url(<%$tpl_base%>/images/template_13.gif);">


    <form action="power_search.php" method="get" name="power_search_frm">
    <input type="hidden" name="pflag" value="search" />

    <table cellpadding="4" cellspacing="1" border="0" align="center" width="100%" class="tbl_border">

    <tr class="tbl_normal">
    <td>Movie Title:</td>
    <td><input class="text3" type="text" name="title" size="40" value="" /><input type="submit" name="submit" value="Search" /></td>
    </tr>
    </table>
    </form>
    To my surprise, it works! Well I lost the "latest search" mod, the design changed a bit, this can't be the right way doing this.

    In additional to this I would really like a drop down menu (like in power search) where users can choose a category to search within.
    Last edited by Warz; 04-10-2008 at 01:45 PM.

  9. #9
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    you had it right before, with one missing item, you need a hidden field called pflag, it tells indexu if it needs to display the form or submit it... add this to your previous item :

    <input type="hidden" name="pflag" value="search" />

    Latest search works on the log files indexu uses, unfortunately this is only the case for normal "keyword searches" you would need to play with the code so power search title phrases got logged... if you need the search category your simplest way of doing it would be to visit the powersearch page, right click, and view source. Copy the whole of the select box and all the items, and use this in your search box form.

    You obviously lose the ability for new categories to automatically be updated on this dropdown, but its the easy way... worth it if your categories are unlikely to change much.
    Last edited by inspireme; 04-10-2008 at 01:51 PM.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  10. #10
    Join Date
    Jan 2008
    Posts
    141

    Default

    Excellent advice, thanks a lot!! Works very well for me now I will try to get the latest search thing work tomorrow. Thanks

  11. #11
    Join Date
    Jan 2008
    Posts
    141

    Default

    Hi,

    Do you know which file I should edit ? I have tried to change the block.searching_large.html file to fit the power search, but doesn't seem to work. If I didn't misunderstand you there is another file I would need to edit as well

  12. #12
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    the mod works the same you dont need to change that, you need to work out how indexU works logs the searches... Basically indexU only logs keyword searches on search.php, (in your case you wont be using this any more) so you need to look in the "search.php" file and fidn the code thats use to record all the searches, and then use this in powersearch.php
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  13. #13
    Join Date
    Jan 2008
    Posts
    141

    Default

    Well I find this code in search.php, but have no idea how to implement into power_search.php

    if ($record_log) {
    $date = date("Y-m-d H:i:s");
    $ip = $_SERVER["REMOTE_ADDR"];
    $query = "insert into idx_searchlog (keyword,time,ip,result) values ('$keyword','$date','$ip','0')";
    $result = $dbConn->Execute($query);
    }
    If you could fix the power_search file for me I am willing to pay for it.

  14. #14
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    around line 227 of power search try this :

    $num_links = $links_obj->record_count_of_display;
    $pagination = $links_obj->pagination;


    if ($title) {
    $date = date("Y-m-d H:i:s");
    $ip = $_SERVER["REMOTE_ADDR"];
    $query = "insert into idx_searchlog (keyword,time,ip,result) values ('$title','$date','$ip','$num_links')";
    $result = $dbConn->Execute($query);
    }


    DisplayTemplate($theme_path . "power_search_result.html", "\$link,\$num_links,\$pagination");


    bold is for context. 100% untested!
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  15. #15
    Join Date
    Jan 2008
    Posts
    141

    Default

    Power_search.php:
    Code:
    222      $i++;
    223    }
    224
    225    $links_obj->more_param
    226                =
    227      "&pflag=search&title=$title&url=$url&description=$description&cat=$cat&contact_name=$contact_name&email=$email"
    228      . $custom_field_param;
    229
    230    $link       = $links_obj->Display();
    231    $num_links  = $links_obj->record_count_of_display;
    232    $pagination = $links_obj->pagination;
    233
    234    DisplayTemplate($theme_path . "power_search_result.html", "\$link,\$num_links,\$pagination");
    235  }
    I tried to place the code as you said in between, so on line 233. Also tried on line 224, and on line 236. All failed, error: Fatal error: Call to a member function Execute() on a non-object in /home/mywebsite/public_html/power_search.php on line 231
    Last edited by Warz; 04-12-2008 at 04:48 PM.

Similar Threads

  1. Replies: 12
    Last Post: 10-13-2007, 11:29 AM
  2. top 10 search by search keywords
    By landuyt in forum v3.2
    Replies: 2
    Last Post: 06-23-2005, 11:18 AM
  3. power search doesn't search certain cats
    By Rob Picken in forum v5.x
    Replies: 9
    Last Post: 06-15-2004, 02:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •