Bug 487014 - System search, search is listing one system, should go to system sdc
System search, search is listing one system, should go to system sdc
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 5
Classification: Red Hat
Component: WebUI (Show other bugs)
530
All Linux
low Severity medium
: ---
: ---
Assigned To: Partha Aji
Red Hat Satellite QA List
http://grandprix.rhndev.redhat.com/rh...
: Reopened
Depends On:
Blocks: sat540-blockers
  Show dependency treegraph
 
Reported: 2009-02-23 12:17 EST by wes hayutin
Modified: 2010-10-23 03:51 EDT (History)
5 users (show)

See Also:
Fixed In Version: sat530
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-26 10:52:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description wes hayutin 2009-02-23 12:17:28 EST
Description of problem:

small use case here..

System search,  search is listing one system, should go to system sdc

recreate...
1. register the same system 4 times
2. delete three of the profiles
3. system search for system
4. results of system search include one result of system

actual results:
The system is listed, in a list


expected results:
page is redirected to systems sdc page if its the only result
Comment 2 John Matthews 2009-04-14 20:17:53 EDT
Moving this to ON_QA, as I think it's been fixed...or the test case involved a low scoring match in which case it's intentional behavior to display a list of 1 and not redirect to SDC.


Looking through the code I see one possibility that could trigger this behavior.
Assume you register "test.system.redhat.com", then do a search for "te" or "test".  You would get back a result which has a score less than .95, so it will not redirect to the SDC page.  Redirects to SDC are written to only happen when a match is close to ideal, it has to have a score of .95 or greater.

Below is a code snippet showing how it's written.

This will look to see if we only have 1 result, it then checks the score

            List results = (List)request.getAttribute(getDataSetName());
            if ((results != null) && (results.size() == 1)) {
                SystemSearchResult s =  (SystemSearchResult) results.get(0);
                Double score = s.getScore();
                if (score != null) {
                    /** Adding a rule so we only redirect to a specific system id
                     * when we are pretty sure the search result is what the user
                     * expects.  We are using the lucene score for this result to
                     * gauge this.
                     */
                    if (score > 0.95) {
                        try {
                            response.sendRedirect(
                                    "/rhn/systems/details/Overview.do?sid=" +
                                        s.getId().toString());
                            return null;
                        }
                        catch (IOException ioe) {
                            throw new RuntimeException(
                                    "Exception while trying to redirect: " + ioe);
                        }
                    }
                }
            }
Comment 3 wes hayutin 2009-04-17 15:50:10 EDT
not working in 4/14 build
Comment 4 John Matthews 2009-04-27 14:20:12 EDT
The issue is on the search-server side. 

The problem is that the systems while deleted from the DB are not being removed from the search server index.  This reduces the score returned, since the hit is not unique, it's score drops.  I'm looking into why the index isn't clearing up the deleted systems.
Comment 5 John Matthews 2009-05-29 15:19:45 EDT
I think I was wrong with comment #4 being the cause, this appears to be fine if I wait long enough for the indexing task to kick off.

The problem Wes is mentioning may have been a simpler problem of the query not matching that well, so the score was low.  We originally had a check that the score needed to be over .95 to redirect to SDC.  Now I've lowered it to .50 to allow a redirect for more matches of a single term.  



vader branch:  
 java/code/src/com/redhat/rhn/frontend/action/systems/SystemSearchSetupAction.java        |    4 +++-
 search-server/src/java/com/redhat/satellite/search/scheduler/tasks/GenericIndexTask.java |    2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 143000384eb4509922777146f282fb512aa98958
Author: John Matthews <jmatthew@redhat.com>
Date:   Fri May 29 15:06:08 2009 -0400
Comment 6 wes hayutin 2009-06-08 14:29:31 EDT
hrm.. not sure if this landed in 6/5
fails
Comment 7 John Matthews 2009-06-09 14:21:18 EDT
I think the problems happening with this bug were related to low scores.  I spoke with Wes and we decided to remove the score requirement which was causing 1 result to display in a list instead of being redirected when it had a low score.

Below commit removes the score requirement, now any system search result of only 1 item will redirect to the SDC page for that system id.


commit a1f466e8b345e4dc6bd7fccb3feded486bee6faa
Refs: vader, <origin/VADER>, rhn-custom-info-5.3.0-1-23-ga1f466e
Author:     John Matthews <jmatthew@redhat.com>
AuthorDate: Tue Jun 9 14:10:36 2009 -0400
Commit:     John Matthews <jmatthew@redhat.com>
CommitDate: Tue Jun 9 14:14:01 2009 -0400

    487014 - SystemSearch remove score requirement to redirect to SDC on 1 result
    Additionally lowered default config value for system search score threshold
---
 .../action/systems/SystemSearchSetupAction.java    |   31 ++++++-------------
 search-server/src/config/search/rhn_search.conf    |    2 +-
 2 files changed, 11 insertions(+), 22 deletions(-)
Comment 8 wes hayutin 2009-06-15 14:16:33 EDT
verified 6/12
Comment 9 Jan Pazdziora 2009-09-04 08:28:30 EDT
Stage verified with Satellite-5.3.0-RHEL5-re20090820.1 using the test plan from comment 0. Installed system four times with the same name. Searched, four four records in the result list. Deleted three systems, confirmed. Searched, found one and was placed directly to /rhn/systems/details/Overview.do. Moving to RELEASE_PENDING.
Comment 10 Brandon Perkins 2009-09-10 15:32:02 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1434.html

Note You need to log in before you can comment on or make changes to this bug.