Discussion:
Customizing Catalog Search
(too old to reply)
j***@usmint.treas.gov
2006-11-29 16:37:38 UTC
Permalink
Right now we are using an out of the box search that is searching with searchTermScope=3, meaning that the following columns are searched:

CATENTDESC.NAME
CATENTDESC.SHORTDESCRIPTION
CATENTDESC.LONGDESCRIPTION

and the results are ordered by CATENTDESC.NAME.

What I would LIKE to do, is to return first the matches from CATENTDESC.NAME then the matches from CATENTDESC.SHORTDESCRIPTION and finally the matches from CATENTDESC.LONGDESCRIPTION. So that if there is a product named "Wilson Soccer Ball" and another product named "Abbott Ball" with a description that includes the text "This is a fine example of a Wilson Soccer Ball" then the product that is named "Wilson Soccer Ball" is still returned first from a search where the search text is "Wilson Soccer Ball".

What is happening now is that the product "Abbott Ball" is returned first, since there is a match in the description ("This is a fine example of a Wilson Soccer Ball") and because they are sorted by product name.

Any ideas?
geo
2006-11-29 19:40:23 UTC
Permalink
This is not possible.

The closest you could probably come is instantiate three search databeans
with

scope=1 on the first (name)
scope=2 on the second (name, shortdescription)
scope=3 on the third (long desc)

Then you would display the results from the first bean, and put all the
productIds in a set

display the results from the second bean that are not in the set and add
those displayed to the set

display the results from the third bean that are not in the set
Post by j***@usmint.treas.gov
Right now we are using an out of the box search that is searching with
CATENTDESC.NAME
CATENTDESC.SHORTDESCRIPTION
CATENTDESC.LONGDESCRIPTION
and the results are ordered by CATENTDESC.NAME.
What I would LIKE to do, is to return first the matches from
CATENTDESC.NAME then the matches from CATENTDESC.SHORTDESCRIPTION and
finally the matches from CATENTDESC.LONGDESCRIPTION. So that if there is
a product named "Wilson Soccer Ball" and another product named "Abbott
Ball" with a description that includes the text "This is a fine example of
a Wilson Soccer Ball" then the product that is named "Wilson Soccer Ball"
is still returned first from a search where the search text is "Wilson
Soccer Ball".
What is happening now is that the product "Abbott Ball" is returned first,
since there is a match in the description ("This is a fine example of a
Wilson Soccer Ball") and because they are sorted by product name.
Any ideas?
j***@usmint.treas.gov
2006-11-30 18:31:39 UTC
Permalink
I am trying your approach, but I've run into a problem. I am trying to run the first bean that uses searchTermScope=1 - which according to the documentation should search by name and short description. Unfortunately, neither CATENTDESC.NAME nor CATENTDESC.SHORTDESCRIPTION is actually being searched.

Here is my code:

super.setSearchTermScope(new Integer("1"));
super.populate();
debug("The query is: "+q.toString());

And the sql statement (from my logs) is:

select distinct CATENTRY.CATENTRY_ID, CATENTDESC.NAME from CATENTRY, CATGPENREL, OFFERPRICE, OFFER, CATENTDESC, STORECENT, TRADEPOSCN where ((((((((((((((upper(CATENTRY.PARTNUMBER) like '%NICKEL%')) or ((upper(CATENTRY.PARTNUMBER) like '%NICKEL%'))) and CATGPENREL.CATALOG_ID = 10001) and OFFERPRICE.PRICE >= 0) and OFFERPRICE.CURRENCY = 'USD') and (OFFER.MAXIMUMQUANTITY is null or OFFER.MINIMUMQUANTITY is null )) and OFFERPRICE.PRICE <= 1000000) and OFFERPRICE.CURRENCY = 'USD') and (OFFER.MAXIMUMQUANTITY is null or OFFER.MINIMUMQUANTITY is null ))) and (((CATENTRY.BUYABLE = 1 and CATENTRY.MARKFORDELETE <> 1 and CATENTDESC.PUBLISHED = 1 and CATENTDESC.LANGUAGE_ID = -1))) and STORECENT.STOREENT_ID in (10001) and TRADEPOSCN.TYPE = 'S' and ((CATENTRY.CATENTTYPE_ID = 'ProductBean')))) and (CATENTRY.CATENTRY_ID = (OFFER.CATENTRY_ID) and CATENTRY.CATENTRY_ID = (STORECENT.CATENTRY_ID) and OFFER.OFFER_ID = (OFFERPRICE.OFFER_ID) and CATENTRY.CATENTRY_ID = (CATENTDESC.CATENTRY_ID) and CATENTRY.CATENTRY_ID = (CATGPENREL.CATENTRY_ID) and OFFER.TRADEPOSCN_ID = (TRADEPOSCN.TRADEPOSCN_ID))) order by CATENTDESC.NAME asc


I don't see CATENTDESC.NAME or CATENTDESC.SHORTDESCRIPTION in this query...
Continue reading on narkive:
Loading...