Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Better Search Engine


jhilgeman

Recommended Posts

Well, nobody responded to my schematic:

http://www.oscommerce.com/forums/viewtopic.php?t=27155

... so I built the ranking plugin by myself and it's in place on my site right now.

 

It performs more accurate searchings by ranking the products by things like keyword density, keyword order, etc.. rather than just ordering alphabetically. It's a pretty quick start and not very full-featured, but I see a huge improvement in my searches.

 

If anyone is interested in implementing my plugin, let me know. It takes about 5 small changes/additions to existing code (two files - advanced_search_result.php and product_listing.php) - all the ranking code is contained within a single "include" file.

 

- Jonathan

Download osCommerce Order Editor v1.2 Here:

http://www.oscommerce.com/community/contributions,1435

Link to comment
Share on other sites

Hi Jonathan,

 

I am interested.

Can you make it into a contribution or just mail me the code?

I'd love to test it.

 

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

I'd rather not make it into a contribution before it gets tested fully.

 

Btw, my osCommerce code is heavily modified, and I tried to strip out all code that wouldn't work on other osCommerce stores, but there may be some stuff left in there that I missed.

 

Here's the code - it has instructions on how to put it to use.

http://www.naturesflavors.com/includes/mod...ankings.inc.txt

 

Let me know what bugs you find, feedback, etc...

 

- J

Download osCommerce Order Editor v1.2 Here:

http://www.oscommerce.com/community/contributions,1435

Link to comment
Share on other sites

thnx, I grabbed it an will play with it tomorrow.

I'll let you know how it goes.

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Just got this thing going (about 5 mins ago) and I am allready impressed.

You'll notice a bit of a slowdown when searching multiple keywords on a 5000 items database

but it is well worth the extra time as you are so much more accurate in results.

 

Has anybody of the dev team tried this? You really should check this out!

 

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

I've been searching for a solution to speed things up a bit, and I've got several ideas going, but some of them would require changes to the database structure, and I'd prefer to keep this a simple plugin for now.

 

However, here are a few of my ideas:

 

1) If I can find a way to make PHP construct a SQL result resource, I can efficiently eliminate a long loop AND keep from changing the code in products_list module. Right now, I convert the SQL result to an array and work with the array.

 

2) Right now it's written for legibility, so the order in which things occur isn't optimized. For instance, the entire ranking process could be moved into the SQL loop, and the final array could be sorted on the fly instead of creating a temporary array, then sorting it, then renaming it so product_listing will "take it" as if nothing happened.

 

3) Small bits of processing occurs on each product description and product name, so having an additional table in the database dedicated to containing search-engine-related fields would speed things up. Take a look at how fast Google is able to produce thousands of results - I'd be willing to bet a lot of money that nearly all of their results are pre-processed with PageRank, and then just looked up later with nearly no processing happening at run time.

 

4) Splitting everything into word arrays isn't exactly efficient, and internal PHP string functions would be able to achieve a lot of the functionality without the overhead of arrays. That's probably what I'll focus on changing next, in addition to the quoted search terms.

 

- Jonathan

Download osCommerce Order Editor v1.2 Here:

http://www.oscommerce.com/community/contributions,1435

Link to comment
Share on other sites

What does the 'dynamic_product_description.inc.php' do?

(gets included on line 107)

Not mentioned in the install text... and I don't have it... :(

 

Thanks,

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Ach. I knew I forgot to take out something. The dynamic product description is a custom-coded module that parses the description for special lines and basically "translates" the code into HTML. For instance, I might have something like:

 

[NUTRITIONAL]

REGULARBOLD Serving Size 1 tbsp.

LINE 4

REGULAR Calories|0|0%

LINE 1

etc...

[/NUTRITIONAL]

 

and the dynamic product description translates that into a nutritional information table.

 

I also have paragraphs of text that are shared (i.e. a certain line of food products may all share the same nutritional information), so instead of copy-n-pasting that info into each of the 100 products that share the information, I use a "shared_text" table and I can on-the-fly pull a piece of shared text from that table and insert it into the description.

 

So maybe I have a shared text record that has all that [NUTRITIONAL]...[/NUTRITIONAL] information for my fruit juices. For every fruit juice, all I have to do is add:

 

SHARED_TEXT keyword, like SHARED_TEXT fruit_juice_nutrition.

 

The dynamic description module then parses it all out. Very handy - I only described it in case it might give an idea to someone else.

 

- Jonathan

Download osCommerce Order Editor v1.2 Here:

http://www.oscommerce.com/community/contributions,1435

Link to comment
Share on other sites

Okay, just wondering if it was needed for the processing / ranking.

What's your idea / plan on wildcard support?

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Yeah but then like Lin* matching Linus AND Linux :)

 

Any plans in that direction? Although I am afraid that will put more strain on the server as it'll do severe pattern matching etc., correct?

 

As far as 'pre-caching' the results go for speed optimization goes;

I think it is well worth adding the table structure to use this contribution.

Don't think anyone that uses contributions objects to adding a few tables here or there if the contribution is worth it.

 

 

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Well, now that I think about it, wildcarding isn't in the scope of this contribution. This plugin only ranks the results that MySQL returns - it doesn't initiate the first search.

 

HOWEVER, modifying the osCommerce engine to include wildcarding shouldn't be a huge task. Right now the SQL statement just does a "WHERE name LIKE '%keyword%'". This could easily be change to WHERE name REGEXP '*keyword*' and then if any keyword had a * in it, it would automatically be included in the regular expression.

 

- Jonathan

Download osCommerce Order Editor v1.2 Here:

http://www.oscommerce.com/community/contributions,1435

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...