UserScore

Name

UserScore -- specifies a SQL query to calculate user defined score for desired documents.

search.htm

Synopsis

UserScore {name} {sql-query}

Description

The "UserScore" command allows to configure user defined scores for some or all documents in the database. The score value calculated by mnoGoSearch is mixed with the user defined value, so you can affect the final rank for desired documents.

It is possible to configure several "UserScore" commands, however only one of them can be used during search time. The "name" argument should be unique in every "UserScore" command. search.cgi detects which "UserScore" command to use taking its name from the "us=name1" HTML form parameter. If no "us" parameter is given, or "us" value is empty, neither of the "UserScore" commands are applied.

The second argument must represent a SQL query returning a result set consisting of two columns. The first column in each record should correspond to ID of a document whose score should be modified.

Note: The IDs of documents are stored in the "rec_id" column of the "url" table of mnoGoSearch database. To know a ID of a certain document you can run this SQL query in mnoGoSearch database:


SELECT rec_id FROM url WHERE url='http://hostname/page1.html';

The second column stands for a user defined score value for this document, returned as signed integer in the range -255..+255. The original score value calculated by mnoGoSearch is mixed with the user defined value as follows:

Examples


# Give more score to documents with longer URL
UserScore long "SELECT rec_id, length(url) FROM url"

# Give more score to documents with shorter URL
UserScore short "SELECT rec_id, -length(url) FROM url"

# Give higher scores to some certain documents:
UserScore list1 "SELECT rec_id, 255 FROM url WHERE rec_id IN (1,100,300)"

See also

UserScoreFactor, the Section called Search parameters in Chapter 8.